1.mysql8.0忘记密码或出现Access denied for user 'root'@'localhost' (using password: YES)
1、找到mysql安装路径
(可以在环境变量中找)
2、以管理员身份打开命令行,停止服务
(win+q输入cmd右击)
(net stop mysql)
3、cd 到mysql安装路径的bin目录,之前版本输入mysqld --skip-grant-tables,8.0输入mysqld --console --skip-grant-tables --shared-memory
4、打开另一个管理员命令行,cd 到mysql安装路径的bin目录,输入mysql,输入use mysql
5、flush privileges;
6、使用alter user'root'@'localhost' IDENTIFIED BY 'Li!123456'; 修改密码
(8.0以后版本密码必须包含大小写字母特殊字符和数字)
7、 flush privileges; (重要)
8、\q退出
9、重新以管理员打开命令行,net start mysql
10、登陆 mysql -u root -p
2.The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized
原文:JDBC连接mysql出现时区错误:The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized...处理方法_蘅时天下的博客-CSDN博客
方法一:
首先打开cmd登录mysql后输入select curtime();或select now();查看当前时间
然后查看当前时区(show variables like “%time_zone%”)
system_time_zone 为空表示当前mysql时间与系统一致,time_zone为SYSTEM表示当前使用的时区为SYSTEM时区
最后将时区更改为现在所在时区(东八区)
<1>set time_zone="+8:00"; 只能修改当前会话窗口的时区,关闭即还原
<2>set global time_zone="+8:00"; 修改全局时区,永久有效
3 logstash使用过程中,虚拟机(linux)连主机(win10)mysql(8.0.22)连不通的问题(本来以为是logstash版本和mysql connector版本的问题,走了半天弯路。。。)
Could not create connection to database server. Attempted reconnect 3 times. Giving up
到主机mysql bin目录下
mysql -uroot -p123456 登录mysql
use mysql;
grant all privileges on *.* to 'root'@'%' identified by 'root' with grant option;(mysql8.0不适用)
或https://www.cnblogs.com/Loners/p/12348366.html
MySQL 8.0已经不支持下面这种命令写法
grant all privileges on *.* to root@"%" identified by ".";
正确的写法是先创建用户
CREATE USER 'root'@'%' IDENTIFIED BY 'Hadoop3!';
再给用户授权
grant all privileges on *.* to 'root'@'%' ;
4. javax.net.ssl.SSLException MESSAGE: closing inbound before receiving peer's close_notify
配置连接数据库的url时,加上useSSL=false
jdbc:mysql://localhost:3306/tablename?useUnicode=true&characterEncoding=UTF-8&autoReconnect=FALSE&serverTimezone=GMT&useSSL=false
5. Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) - Stack Overflow
Are you connecting to "localhost" or "127.0.0.1" ? I noticed that when you connect to "localhost" the socket connector is used, but when you connect to "127.0.0.1" the TCP/IP connector is used. You could try using "127.0.0.1" if the socket connector is not enabled/working.
localhost换成127.0.0.1,还真有用