MySQL 远程访问

2019-03-14  本文已影响0人  doingy

os: Ubuntu

安装

$ sudo apt-get update
$ sudo apt-get install mysql-server

安全配置

$ mysql_secure_installation

取消绑定

$ vi /etc/mysql/mysql.conf.d/mysqld.cnf
#bind-address = 127.0.0.1
#to
#bind-address = 0.0.0.0
#重启服务
$ systemctl restart mysql.service

授权

$ grant all privileges on *.* to 'root'@'%' identified by '*****';
$ flush privileges;

常用命令

$ systemctl status mysql.service
$ systemctl restart mysql.service
$ mysql -p -uroot -e "show variables like '%character%'"

字符集查看

$ show variables like '%character%';
$ sudo vi /etc/mysql/my.cnf
[mysqld]
character-set-server=utf8
collation-server=utf8_general_ci
上一篇下一篇

猜你喜欢

热点阅读