1 zip文件解压到目录 D:Alantop_Diralantop_sdeMySQL-8.0.27
2 在mysql-8.0.27目录下建立my.ini文件
[mysqld]
default_authentication_plugin=mysql_native_password
# 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:\alantop_dir\alantop_sde\mysql-8.0.27"
datadir = "D:\alantop_dir\alantop_sde\mysql-8.0.27\Data"
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
#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初始化数据库和默认密码
mysqld --initialize --console
注意:键入上面命令后,控制台上会显示默认密码,如果没记住,可以从data文件中日志文件err中查询。
4 安装启动mysql服务
mysqld --install mysql
net start mysql
5 用heidisql登录,第一次登录会提示修改默认密码。
6 查看修改用户加密方式
select host,user,plugin from mysql.user;
ALTER USER 'test1'@'localhost' IDENTIFIED WITH mysql_native_password BY '123';
FLUSH PRIVILEGES;
如果此处修改了密码认证方式,my.ini中的
default_authentication_plugin=mysql_native_password
这句可以删除掉。
采用mysql_native_password认证方式主要是兼容有些程序的密码认证方式。