mysql创建用户:
mysql> grant all privileges on *.* to zyl@'%' identified by '123';Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
登陆:
[root@mta222 mysql]# mysql -u zyl -p --socket=/tmp/zhangyl/mysql.sock
ERROR 1045 (28000): Access denied for user 'zyl'@'localhost' (using password: YES)
后来把grant all privileges on *.* to zyl@'%' identified by '123'; “%”改成了localhost就可以了,
成功登陆后,我再把localhost改成%,再登陆也是可以的。究竟是为什么我也不清楚,如果有人也遇到这样的问题,解决不了,可以试试这个方法。