phpstudy启动服务之后navicat for mysql连接不上,一直出现1045错误

2024-11-20 02:27:04
推荐回答(1个)
回答1:

mysqladmin -h hostname flush-privileges
use mysql; update user set password =password('yourpass') where user='root'
出现无法连接数据库的话,命令行用root用户登陆,敲下面命令:
SET PASSWORD FOR sns@'localhost'=OLD_PASSWORD('sns');
然后刷新mysql权限
FLUSH PRIVILEGES;
导入数据的方法 mysql -u name -p --default-character-set=utf8 databasename < path\*.sql

create database name character set utf8;
如果出现#1251 - Client does not support authentication protocol requested by server;的错误:
解决办法:先用root登录MYSQL服务器,执行

mysql>set password for user1@"localhost"=old_password('yourPassword');