提示”Access denied for user ‘root’@’localhost’ (using password: YES)”
1.是否被修改了root密码
/etc/init.d/mysql stop mysqld_safe –skip-grant-tables & mysql -uroot -p mysql>update mysql.user set password=password(‘mypassword’) where user=’root’; mysql>flush privileges; mysql>quit
2.localhost是否没有映射到root
mysql -u root -p -h 127.0.0.1 grant all privileges on . to ‘root’@’localhost’ identified by ‘mypassword’ with grant option; grant all privileges on . to ‘root’@’118.192.91.xxx’ identified by ‘mypassword’ with grant option;
select user,host,password from user; 再查询用户表
mysql -h localhost和mysql -h 127.0.0.1的区别,通过localhost连接到mysql是使用UNIX socket,而通过127.0.0.1连接到mysql是使用TCP/IP