The user specified as a definer (‘root’@’%’) does not exist
在使用mysql视图是出现问题: The user specified as a definer ('root'@'%') does not exist。
一般是由于root用户对全局host无访问权限。因此只要给root用户添加一个访问权限即可。
解决办法:
登陆mysql ,执行
mysql -u root -pPasswd
mysql >grant all privileges on *.* to root@"%" identified by "Passwd"
mysql >flush privileges
[来自](http://blog.csdn.net/b422761838/article/details/8621124)
MYSQL ERROR 1045 (28000): Access denied for user (using password: YES)
[root@228827 ~]# /etc/init.d/mysql stop
[root@228827 ~]# /usr/local/mysql/bin/mysqld_safe –skip-grant-tables &
[root@228827 ~]# mysql
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 1
Server version: 5.1.57 Source distribution
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
mysql> use mysql
Database changed
mysql> select user,host,password from user where user='root';
+——+——————-+——————————————-+
| user | host | password |
+——+——————-+——————————————-+
| root | % | *A50E066E106320CF4142 |
| root | centos | *A50E066E106320CF4142 |
| root | 127.0.0.1 | *A50E066E1063608320CF4142 |
+——+——————-+——————————————-+
3 rows in set (0.12 sec)
发现user表host字段中没有localhost,但是我的理解是%代表所有的主机都能登录的,为什么localhost不能呢,同样的情况我在5.0.45版的mysql上面做实验就不会发生localhost无法登录,我当前用的是5.1.57版的,难道是版本的问题?
接下来的修改很明显了:
mysql> update user set host='localhost' where user='root' and host='%';
mysql> flush privileges;
来自 <http://www.111cn.net/database/mysql/49938.htm>
这里记录一下今天遇到的纠结事情:
首先kill掉MySQL进程然后在启动mysql的参数中加入
跳过登录
--skip-grant-tables(windows)
来自 <http://www.111cn.net/database/mysql/49938.htm>
允许root用户在一个特定的IP进行远程登录,并具有所有库任何操作权限,具体操作如下:
在本机先使用root用户登录mysql:
mysql -u root -p"youpassword"
进行授权操作:
GRANT ALL PRIVILEGES ON *.* TO root@"172.16.16.152" IDENTIFIED BY "youpassword" WITH GRANT OPTION;
重载授权表:
FLUSH PRIVILEGES;
The user specified as a definer (‘root’@’%’) does not exist在使用mysql视图是出现问题: The user specified as a definer ('root'@'%') does not exist。一般是由于root用户对全局host无访问权限。因此只要给root用户添加一个访问权限即可。解决办法:登陆mysql ,执行