想使用navicat远程访问一下我的腾讯云上的MySQL数据库,可是怎么也访问不不通。
通过https://blog.csdn.net/weixin_44232093/article/details/105487990fff
这篇博客的指引才连接上。
目录
#回看当初配置wordpress时配置mysql
https://cloud.tencent.com/document/product/213/8044

创建的一个用户user,@'localhost'表示只能本机访问。所以用这个账户远程navicate是无法创建连接的。这个就涉及到MySQL访问权限的问题。
#PRIVILEGES(MySQL授权)
https://www.cnblogs.com/f-ck-need-u/p/8994220.html(MariaDB,密码设置等)
https://www.php.cn/mysql-tutorials-415603.html(包括查看权限等)
https://jingyan.baidu.com/article/455a9950a4fea0a16727787e.html
1)指定授权访问用户类型
userName@'localhost':表示只能本机的userName用户访问
userName@'192.168.1.3':表示只能ip是192.168.1.3的主机的userName用户访问
userName@'%':表示任何主机的userName用户都能访问
2)指定用户权限类型
all privileges表示享有对指定数据库的所有权限,包含以下权限:
select,
insert,
update,
delete,
create,
drop,
references,
index,
alter,
create temporary tables,
lock tables,
execute,
create view,
show view,
create routine,
alter routine,
event,
trigger
只想赋予只读权限:
GRANT SELECT ON ...
FLUSH PRIVILEGES
其它的依此类推。
#查看用户权限:
show grants for 'root'@'localhost';
3)指定用户对哪些数据库有权限
GRANT SELECT ON 数据库名.*
上面数据库名就是针对这个数据库的访问权限,如果为*.*表示对所有的数据库赋予权限。
0 条评论