当前位置:Gxlcms > 数据库问题 > 安装mysql

安装mysql

时间:2021-07-01 10:21:17 帮助过:4人阅读

使用上面的命令直接安装Yum Repository

[root@localhost ~]# yum -y install mysql57-community-release-el7-10.noarch.rpm

安装MySQL

root@localhost ~]# yum -y install mysql-community-server

启动MySQL

[root@localhost ~]# systemctl start mysqld

查看MySQL运行状态

systemctl status mysqld

停止mysql

systemctl stop mysqld

查看root账号密码

[root@localhost ~]# grep "password" /var/log/mysqld.log

2018-12-10T08:02:37.585544Z 1 [Note] A temporary password is generated for root@localhost: i6i/pdTUBbkq

进入mysql

mysql -u root -p

修改mysql密码

mysql> ALTER USER ‘root‘@‘localhost‘ IDENTIFIED BY ‘new password‘;(直接设置密码不能过于简单)

 

可通过如下命令查看完整的初始密码规则

mysql>show variables like ‘validate_password‘;

可通过如下命令修改

mysql> set global validate_password_policy=0;

 

 

 

配置权限

 

#任何主机
mysql>GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘123456‘ WITH GRANT OPTION;

 

#指定主机
mysql>GRANT ALL PRIVILEGES ON *.* TO ‘jack‘@’10.10.50.127’ IDENTIFIED BY ‘654321‘ WITH GRANT OPTION;

 

# 然后刷新权限
mysql>flush privileges;

修改mysql数据库总的user表使相的用户能从某一主机登录

mysql>use mysql;
mysql>update user set host = ‘%‘ where user = ‘root‘;
mysql>select host, user from user;


查看mysql的字符集

mysql>show variables like ‘character_set%‘;

技术分享图片

 

from  https://blog.csdn.net/baidu_32872293/article/details/80557668

 

安装mysql

标签:cte   ble   不能   val   设置   启动mysql   detail   初始   lte   

人气教程排行