MySql---Windows下MySQL5.8安装配置
我的本机环境是 windows 10,下载安装的 MySql 为 v5.8。
2)解压缩,并重命名为 MySQL,放在 Program Files ⽂件夹下。例如:D:\Program Files\MySQL)。
3)修改环境变量。【我的电脑】->右键“属性”->【⾼级系统设置】->【环境变量】->【*** 的⽤户变量】中,新增键值对,键:MySQL 值:D:\Program Files\MySQL,保存;然后编辑“Path” 这个⽤户变量,新增 %MySQL%\bin 然后所有对话框点击【确定】退出。
4)新增⽂件 D:\Program Files\MySQL\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:\Program Files\MySQL
datadir = d:\Program Files\MySQL\data
mysql配置与安装过程port = 3306
# server_id = .....
default_authentication_plugin=mysql_native_password
# 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
5)初始化数据库。以管理员模式打开命令⾏⼯具(这个很重要)然后执⾏命令 d:\Program Files\MySQL\bin\mysqld --initialize --console
注意:此时命令⾏窗⼝中会出现临时密码,例如:
6)安装服务 MySQL8。cmd 中执⾏命令 d:\Program Files\MySQL\bin\mysqld --install MySQL8;
7)启动服务进⾏测试。执⾏命令(启动服务)net start MySQL8,另外停⽌服务的命令是 net stop MySQL8,不需要执⾏;
8)修改 root 密码。执⾏命令 mysql -u root -p,系统会提⽰输⼊密码,此时输⼊第5)步中提⽰的密码,即可登录。登录后,执⾏如下命令(别漏掉分号):
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';  密码会被修改为 password,也可以修改为你期望的密码。

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。