mysql 初探

来源:互联网 发布:淘宝联盟站长 编辑:程序博客网 时间:2024/05/07 19:17


1 问题  用用户登录时 出现如下日志


D:\Program Files\mysql-5.6.24-win32\bin>mysql -u yutest -p
Enter password: ******
ERROR 1045 (28000): Access denied for user 'yutest'@'localhost' (using password:

 YES)

  查看用户yutest 的权限

 mysql> show  grants for 'yutest';
+-------------------------------------------------------------------------------
------------------------+
| Grants for yutest@%
                        |
+-------------------------------------------------------------------------------
------------------------+
| GRANT USAGE ON *.* TO 'yutest'@'%' IDENTIFIED BY PASSWORD '*E710DC2512FCF6F18F
E0D652B53290DCB11F3334' |
+-------------------------------------------------------------------------------
------------------------+
1 row in set (0.00 sec)


 其中yutest 在'%'上是全权限, 所以在localhost登录失败,所以用如下语句,赋予权限

mysql> grant all privileges on testdb.* to 'yutest'@'localhost' IDENTIFIED BY '4
56789';

Query OK, 0 rows affected (0.02 sec)

 在用密码登录,登录成功


D:\Program Files\mysql-5.6.24-win32\bin>mysql -u yutest -p
Enter password: ******
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 14
Server version: 5.6.24 MySQL Community Server (GPL)

 

  


 

0 0
原创粉丝点击