赞
踩
首先,第一次登陆
mysql -uroot -p
创建一个数据库,例如为了安装WordPress我先创一个库
create database wordpress
然后我想要创建一个新的用户叫fan,然后密码是123456,并授权访问WordPress库;当然root也一样
- grant all on wordpress.* to fan@'localhost' identified by '123';
- grant all on wordpress.* to root@'localhost' identified by '123';
mariadb设置远程访问
- GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123' WITH GRANT OPTION;
- GRANT ALL PRIVILEGES ON *.* TO 'fan'@'%' IDENTIFIED BY '123' WITH GRANT OPTION;
修改权限。%表示针对所有IP,password表示将用这个密码登录root用户
最后,别忘了
FLUSH PRIVILEGES;
还有一种方式:
https://blog.csdn.net/u011424614/article/details/105717680
mysql -uroot -p
create database wordpress
grant all on wordpress.* to fan@'127.0.0.1' identified by 'fjh950107';
grant all on wordpress.* to fan@'localhost' identified by 'fjh950107';
grant all on wordpress.* to root@'localhost' identified by 'fjh950107';
mariadb设置远程访问
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'fjh950107' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO 'fan'@'%' IDENTIFIED BY 'fjh950107' WITH GRANT OPTION;
修改权限。%表示针对所有IP,password表示将用这个密码登录root用户
FLUSH PRIVILEGES;
提示403怎么办
https://blog.csdn.net/mxl00z/article/details/83041266
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。