使用 user1 用户登录,验证:[root@localhost ~]# mysql -uuser1 -pEnter password:ERROR 1045 (28000): Access denied for user 'user1'@'localhost' (using password: YES)// 登录失败,因为 mysql 默认使用 socket 登录.需要指定地址.[root@localhost ~]# mysql -uuser1 -h127.0.0.1 -pEnter password:Welcome to the MySQL monitor. Commands end with ; or \g......mysql>// 登录成功.其中 grant 语句是不会记录到命令历史中的.
来源: http://www.bubuko.com/infodetail-2462965.html