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
网友评论