Centos 7.5 YUM安装Mysql

下载Mysql源安装包

1,wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm

yum安装mysql源

2,yum localinstall mysql57-community-release-el7-8.noarch.rpm

检查mysql源是否安装成功

3, yum repolist enabled | grep "mysql.*-community.*"

yum安装Mysql

4, yum install mysql-community-server

启动Mysql服务

5, systemctl start mysqld

并添加开机启动

systemctl enable mysqld systemctl daemon-reload

查看Mysql状态

6,systemctl status mysqld

查看默认的mysql密码

此时Mysql安装完成!!!

接下来修改密码

查看默认的mysql密码

 

7, vi /var/log/mysqld.log

修改mysql的密码

登录mysql: mysql -uroot -p 回车

密码: =>g6hj.Nx4e (上面查看的原始密码)

 

8, set password for 'root'@'localhost'=password('Jamie@3975');

9, 添加远程登陆的用户权限

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'Jamie@3975' WITH GRANT OPTION;

10,修改mysql字符编码

vi /etc/my.cng

添加

character_set_server=utf8

init_connect='SET NAMES utf8'

11 , 重启Mysql

systemctl stop mysqld

systemctl start mysqld

12 ,查看Mysql字符集

show variables like '%character%'

***部分截图演示操作没有贴上了,详细可以查看下面地址***
文章初始地:http://note.youdao.com/noteshare?id=58d77189ff9ff9abd43d05affc0f6f9d&sub=4E67BC8137E14368AF3463D78CE4C6DE

你可能感兴趣的:(Linux笔记)