码迷,mamicode.com
首页 > 数据库 > 详细

安装mysql

时间:2018-12-10 20:54:33      阅读:186      评论:0      收藏:0      [点我收藏+]

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

下载并安装MySQL官方的Yum Repository

[root@localhost ~]# wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm

使用上面的命令直接安装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   

原文地址:https://www.cnblogs.com/fanningwen/p/10098598.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!