安装mysql教程
安装mysql
sudo apt install mysql-server
查看mysql是否正在运行
sudo systemctl status mysql.service
登陆mysql
sudo mysql -u root -p
设置root用户密码
alter user 'root'@'localhost' identified by '100';
赋予root用户外网访问权限
grant all privileges on *.* to 'root'@'%' identified by 'df6100' with grant option;
创建其他用户CLOUD,赋予其操作abc数据库权限
CREATE USER 'CLOUD'@'%' IDENTIFIED BY 'CLOUD';
grant all privileges on abc.* to 'CLOUD'@'%' identified by 'CLOUD' with grant option;
刷新权限
flush privileges;
修改配置文件
sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf
将bind-address和mysqlx-bind-address注释掉
在mysqld下增加
lower_case_table_names=1
event_scheduler=1
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
并重启mysql服务
sudo service mysql restart