mysql5.8安装

初始化-init.bat
E:/Programs/app/mysql-8.4.0-winx64/bin/mysqld.exe --initialize --datadir=E:/Programs/app/mysql-8.4.0-winx64/data_3306 --console

初始化完毕之后,运行-run_3306.bat: 
E:/Programs/app/mysql-8.4.0-winx64/bin/mysqld.exe --defaults-file=E:/Programs/app/mysql-8.4.0-winx64/conf/my_3306.ini

接着修改密码:
alter user 'root'@'localhost' identified by '123456';
不成功的话使用
alter user 'root'@'localhost' identified with mysql_native_password by '123456;
总之两个都试一下吧,总能成功一个


编辑my_3306.ini文件:
[client]
default-character-set=utf8

[mysql]
auto-rehash
default-character-set=utf8

[mysqld]
character-set-server=utf8
port = 3306
innodb_file_per_table=1
back_log = 50
basedir=E:/mysql
datadir=E:/mysql/data_3306
init-connect='set names utf8'

max_connections = 8192
secure_file_priv=""
default-storage-engine=INNODB
innodb_flush_log_at_trx_commit=2
bulk_insert_buffer_size = 512M
innodb_buffer_pool_size = 2G
innodb_log_file_size = 512M
innodb_log_files_in_group = 4
innodb_lru_scan_depth=512

#指定ibdata1文件夹
innodb_data_home_dir =E:/mysql/data_3306/
#指定ibdata1文件名称、自增长大小、文件最大个头儿
#默认ibdata1初始化大小为12M
innodb_data_file_path=ibdata1:8M:autoextend:max:1024M
sync_binlog=500

#innodb_force_recovery=1 
#innodb_file_format=barracuda
#innodb_file_format_max=barracuda



1)、初始化安装
e:\mysql\bin\mysqld.exe --initialize --datadir=E:\mysql\data_3306 --console
会在当前目录下生成一个data_3306文件夹,生成一个超级用户,密码保存在data_3306文件夹下的日志里
2)、启动mysqld 
启动时使用my_3306.ini配置文件(文件名称无所谓),配置多个文件可以启动多个mysql实例。
E:\MySQL\bin\mysqld.exe --defaults-file=E:/MySQL/my_3306.ini
然后使用日志内的超级用户密码登录。
3)、登录mysql
登录时会提示修改root密码,修改后就可以操作了。

mysql8.0更新密码:
alter user 'root'@'%' identified with mysql_native_password by 'your_password' 


mysql_8.4.0_community更新密码
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 8.4.0

mysql> alter user 'root'@'localhost' identified by '123456';
好像又改回去了

如果使用identified with mysql_native_password时,会提示插件mysql_native_password未加载
mysql> alter user root@localhost identified with mysql_native_password by '123456
';
ERROR 1524 (HY000): Plugin 'mysql_native_password' is not loaded