wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
yum -y install mysql57-community-release-el7-10.noarch.rpm
yum -y install mysql-community-server
systemctl start mysqld.service
systemctl status mysqld.service
grep "password" /var/log/mysqld.log
通过日志内容可以查看到默认初始密码
mysql -u root -p 默认密码
use mysql;
SHOW VARIABLES LIKE 'validate_password%';
#设置密码策略为简单
set global validate_password_policy=LOW;
#修改密码
ALTER USER 'root'@'localhost' IDENTIFIED BY '新密码';
yum -y remove mysql57-community-release-el7-10.noarch
PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'admin@1009' WITH GRANT OPTION;
flush privileges;
select host,user from user;
root前面%代表所有ip均可连接
GRANT ALL ON *.* to root@'123.138.78.146' IDENTIFIED BY 'Wang251314.';
FLUSH PRIVILEGES;
CREATE USER 'username'@'host' IDENTIFIED BY 'password';
CREATE USER 'sunny'@'%' IDENTIFIED BY 'Sunny@123';
GRANT privileges ON databasename.tablename TO 'username'@'host'
privileges用户可操作的权限,包括(select,delete,update,insert),如果要为创建的用户开通所有权限指定为all即可
databasename数据库名,指定用户可操作那个数据库
tablesname:表名称,指定用户可操作那个表
GRANT ALL ON *.* TO 'sunny'@'%';
GRANT ALL ON study.* TO 'sunny'@'%';
GRANT SELECT ON study.cnarea_2018 TO 'sunny'@'%';
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有