MySql 8.0.11-Winxp64(免安装版)配置教程
1. 解压zip包到安装目录
首先,将mysql-8.0.11-winx64.zip 解压缩到 安装d:/mysql-8.0.11-winx64 目录下,
2.配置文件
在安装根目录下添加 my.ini
基本配置文件(my)
[mysqld] basedir = d:\mysql-8.0.11-winx64 datadir = d:\mysql-8.0.11-winx64\data port = 3306 lower_case_table_names = 2 default_authentication_plugin=mysql_native_password
参考 基本配置:
[mysqld] # remove leading # and set to the amount of ram for the most important data # cache in mysql. start at 70% of total ram for dedicated server, else 10%. # innodb_buffer_pool_size = 128m # remove leading # to turn on a very important data integrity option: logging # changes to the binary log between backups. # log_bin # these are commonly set, remove the # and set as required. basedir = d:\program\mysql datadir = d:\dbs\mysql port = 3306 # server_id = ..... # remove leading # to set options mainly useful for reporting servers. # the server defaults are faster for transactions and fast selects. # adjust sizes as needed, experiment to find the optimal values. # join_buffer_size = 128m # sort_buffer_size = 2m # read_rnd_buffer_size = 2m sql_mode=no_engine_substitution,strict_trans_tables character-set-server = utf8mb4 performance_schema_max_table_instances = 600 table_definition_cache = 400 table_open_cache = 256 [mysql] default-character-set = utf8mb4 [client] default-character-set = utf8mb4
3.初始化数据库
在mysql安装目录的 bin 目录下执行命令:
mysqld --initialize --console
执行完成后,会打印 root 用户的初始默认密码,比如:
2018-04-20t02:35:01.507037z 0 [warning] [my-010915] [server] 'no_zero_date', 'no_zero_in_date' and 'error_for_division_by_zero' sql modes should be used with strict mode. they will be merged with strict mode in a future release. 2018-04-20t02:35:01.507640z 0 [system] [my-013169] [server] d:\program\mysql8\bin\mysqld.exe (mysqld 8.0.11) initializing of server in progress as process 11064 2018-04-20t02:35:01.508173z 0 [error] [my-010340] [server] error message file 'd:\program\mysql\share\english\errmsg.sys' had only 1090 error messages, but it should contain at least 4512 error messages. check that the above file is the right version for this program! 2018-04-20t02:35:05.464644z 5 [note] [my-010454] [server] a temporary password is generated for root@localhost: apwcy5ws&hjq 2018-04-20t02:35:07.017280z 0 [system] [my-013170] [server] d:\program\mysql8\bin\mysqld.exe (mysqld 8.0.11) initializing of server has completed
其中,第4行的“apwcy5ws&hjq”就是初始密码,在没有更改密码前,需要记住这个密码,后续登录需要用到。
如果没记住,那也没事,删掉初始化的 datadir 目录,再执行一遍初始化命令,又会重新生成的。当然,也可以使用安全工具,强制改密码,用什么方法,自己随意。
4.安装服务
在mysql安装目录的 bin 目录下执行命令:
mysqld --install [服务名]
4.启动服务
net start mysql
更改密码和密码认证插件
在mysql安装目录的 bin 目录下执行命令:
mysql -uroot -p
这时候会提示输入密码,记住了第3步的密码,填入即可登录成功,进入mysql命令模式。
之前,mysql的密码认证插件是“mysql_native_password”,而现在使用的是“caching_sha2_password”。
因为当前有很多数据库工具和链接包都不支持“caching_sha2_password”,为了方便,我暂时还是改回了“mysql_native_password”认证插件。
在mysql中执行命令:
alter user 'root'@'localhost' identified with mysql_native_password by 'password';
修改密码验证插件,同时修改密码。
如果想默认使用“mysql_native_password”插件认证,可以在配置文件中配置default_authentication_plugin项。
[mysqld] default_authentication_plugin=mysql_native_password
总结
以上所述是小编给大家介绍的mysql 8.0.11-winxp64(免安装版)配置教程,希望对大家有所帮助
推荐阅读