Stand-alone installation of mysql

Check whether the installation of MySQL:
centos6:
rpm -qa | grep mysql
centos7:
RPM -qa | grep MariaDB
or rpm -qa | grep mysql

There are older versions can execute commands to uninstall:

rpm -e --nodeps mysql-libs

 

1、

cat > /etc/yum.repos.d/mysql-community-el7.repo<<'EOF'

[mysql57-community]

name=MySQL 5.7 Community Server

baseurl=http://mirror.tuna.tsinghua.edu.cn/mysql/yum/mysql57-community-el7/

enabled=1

gpgcheck=0

EOF

2.

yum install mysql-community-server -y

systemctl restart mysqld

# Mysqld.log query password

grep password /var/log/mysqld.log 

2019-04-09T07:28:44.292450Z 1 [Note] A temporary password is generated for root@localhost: wg:V45ci4ljpz!r

3. change /etc/my.cnf

 

4. Restart 

# After landing revise your own password:

mysql> alter user user() identified by 'test123456';

 

 5. Check authorization

select user,host from mysql.user;

 

 

Guess you like

Origin www.cnblogs.com/hongfeng2019/p/11785612.html