mysql 8 的远程连接问题

mysql 8 的远程连接问题,第1张

问题:最近开始用mysql8,结果发现在sql语法比之前的版本严格了许多。。此处先解决授权sql报错问题,报错如下

mysql>grant all on dev1_test1.* to dev1@'%' identified by '12345678'

ERROR 1064 (42000): You have an error in your SQL syntaxcheck the manual that corresponds to your MySQL server version for the right syntax to use near 'identified by '12345678'' at line 1

解决:mysql8 要求先建用户,后授权

然后打开mysql默认的3306端口

然后允许使用旧的密码验证方式:

最后 sqlyog就可以远程登陆了。

如果先安装了一个版本的,再安装新版本,需要先把旧版本的数据删除,否则启动不起来,重点是删除 /var/lib/mysql下的所有文件

select @@validate_password_policy

set global validate_password_policy=0

update mysql.user set authentication_string=password('new password') where user='root'

允许root 远程登录:

grant all privileges on . to 'root'@'%' identified by 'password' with grant option

select host,user from user where user='root'

flush privileges

https://mvnrepository.com/artifact/mysql/mysql-connector-java/8.0.19

选择mysql连接,连接方式选择JNDI,JNDI名称填写MYSQL8_DB

点击测试之后:

写入SQL语句,预览信息


欢迎分享,转载请注明来源:内存溢出

原文地址:https://www.54852.com/zaji/8506269.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-04-17
下一篇2023-04-17

发表评论

登录后才能评论

评论列表(0条)

    保存