mysql添加远程登录账户
作者:互联网
为了远程连接,您必须使MySQL将端口3306绑定到my.cnf中计算机的IP地址。然后,您必须同时在localhost和'%'通配符中创建用户,并在所有DB上授予权限。
修改my.cnf,如果不存在这行则添加,可以输入0.0.0.0
bind-address = xxx.xxx.xxx.xxx
然后输入mysql命令
mysql> CREATE USER 'myusername'@'localhost' IDENTIFIED BY 'mypassword';
mysql> CREATE USER 'myusername'@'%' IDENTIFIED BY 'mypassword';
mysql> GRANT ALL ON *.* TO 'myusername'@'localhost';
mysql> GRANT ALL ON *.* TO 'myusername'@'%';
mysql> flush privileges;
标签:登录,mypassword,xxx,myusername,USER,mysql,远程,localhost 来源: https://www.cnblogs.com/liuzhenwei/p/14220562.html