Home > Database > Mysql Tutorial > body text

MySQL常见问题解决办法整理_MySQL

WBOY
Release: 2016-06-01 13:30:26
Original
908 people have browsed it

bitsCN.com

MySQL常见问题解决办法整理
 

问题一:本机创建用户后,该用户无法登录。
问题描述:
通过root创建一个数据库,然后指定该数据库允许访问的用户名

mysql> CREATE DATABASE keystone;mysql> GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'%' IDENTIFIED BY '123456';  mysql> FLUSH PRIVILEGES;
Copy after login


检查该用户是否能正常访问mysql
# mysql -u keystone -p123456 -D keystoneERROR 1045 (28000): Access denied for user 'keystone'@'localhost' (using password: YES)
Copy after login

MySQL常见问题解决办法整理_MySQL
解决办法:分析该授权语句,所有的权限都是赋予到'keystone'@'%'该用户上,而%的意思是允许任何IP访问,但无法解析'localhost'。假如你是在server本地登录mysql,则会弹出上述错误,'keystone'@'localhost',这时解决办法如下:
mysql> GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'localhost' IDENTIFIED BY '123456';  
Copy after login

MySQL常见问题解决办法整理_MySQL


bitsCN.com
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template