mysql备忘录

密码问题

1
2
3
#/etc/my.cnf
[mysqld]
skip-grant-tables=1
1
2
FLUSH privileges;
ALTER USER 'root'@'localhost' IDENTIFIED BY 'admin@123';

重启

1
systemctl restart mysqld

com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException:
Could not create connection to database server. Attempted reconnect 3

https://www.cnblogs.com/ianhuafeng/p/12403626.html
https://zhuanlan.zhihu.com/p/632935077

Install MySql in Windows, download zip file from https://dev.mysql.com/downloads/windows/installer/5.7.html

mysqld --initialize --console
mysqld --install mysql
net stop mysql
mysqld --skip-grant-tables
	mysql -u root -p
		use mysql;
		select * from user;
		update user set authentication_string=password("123456") where user="root";
		flush privileges;
net start mysql

refer to:
https://www.cnblogs.com/huaisn/articles/14149356.html