1.下载
MYSQL服务下载地址:https://dev.mysql.com/downloads/mysql/
2.解压
3.修改配置
在解压出的文件主目录中创建一个文本文件: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:\\bigdata\mysql-8.0.13-winx64 #MySQL主目录位置 datadir = D:\\bigdata\mysql-8.0.13-winx64\data # 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 |
4.初始化数据库
管理员身份运行cmd
D:\bigdata\mysql-8.0.13-winx64\bin\mysqld --initialize --console
输出:
2018-11-28T02:21:15.093589Z 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-11-28T02:21:15.093654Z 0 [System] [MY-013169] [Server] D:\bigdata\mysql-8.0.13-winx64\bin\mysqld.exe (mysqld 8.0.13) initializing of server in progress as process 22548 2018-11-28T02:21:44.207571Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: jrotKgpv8n-t 2018-11-28T02:22:00.823441Z 0 [System] [MY-013170] [Server] D:\bigdata\mysql-8.0.13-winx64\bin\mysqld.exe (mysqld 8.0.13) initializing of server has completed |
上面方框中加粗的字符串为密码
5.安装MySQL服务
D:\bigdata\mysql-8.0.13-winx64\bin\mysqld --install mysql8
输出:
Service successfully installed. |
6.启动MySQL服务
D:\bigdata\mysql-8.0.13-winx64\bin\net start mysql8
输出:
mysql8 服务正在启动 ... mysql8 服务已经启动成功。 |
7.登陆MySQL
Mysql -uroot -p
jrotKgpv8n-t
8.修改密码和密码验证插件
ALTER USER 'root’@'localhost' IDENTIFIED WITH mysql_native_password BY '!QAZ2wsx12';