1.下载 mysql8
需要下载 window的 zip版本
2.解压
D:\software\mysql\mysql-8.0.16-winx64
2.在这个目录下创建一个 my.ini 的文件
[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:/software/mysql/mysql-8.0.16-winx64 datadir = D:/software/mysql/mysql-8.0.16-winx64/data port = 3308 # 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
注意修改 basedir,datadir 两个目录。
3.执行初始化
mysqld --initialize --console
记住这个密码
4.安装mysql 服务
这个需要在超管的身份下执行 mysqld --install mysql8
启动服务 net start mysql8
5.修改初始密码
mysql -uroot -p 输入密码登录
修改初始密码
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';