当前位置:网站首页>Install MySQL database

Install MySQL database

2022-06-13 03:02:00 good_ boys

How to install MySQL database

One 、 install YUM Repo

1、 because CentOS Of yum There is no mysql, Need to mysql Download on yum repo The configuration file .

Download command :

wget https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm

2、 Then proceed repo Installation :

rpm -ivh mysql57-community-release-el7-9.noarch.rpm

After the execution is completed, it will be in /etc/yum.repos.d/ Two repo file mysql-community.repo mysql-community-source.repo

recommend :MySQL course

Two 、 Use yum Command to complete the installation

Be careful : Must enter into /etc/yum.repos.d/ Then execute the following script

1、 Installation command :

yum install mysql-server

2、 start-up msyql:

systemctl start mysqld # start-up MySQL

3、 Get temporary password for installation ( This is the password you use when you log in for the first time ):

grep ‘temporary password’ /var/log/mysqld.log

4、 If you don't get a temporary password , be

4.1、 Remove the previously installed mysql Residual data

rm -rf /var/lib/mysql

4.2. Restart mysql

systemctl start mysqld # start-up MySQL

  • Forget the password :
    open mysql5.7 Configuration file for my.cnf, And add a line to it :skip-grant-tables Save and exit (:wq)
    restart
  • use root To login : [[email protected] ~]# mysql -u root
    Use mysql Medium mysql database : mysql> use mysql;
    Change Password : update user set authentication_string = password(“Szfore_68638”) where user=“root” ;
    Refresh database : flush privileges;
    sign out : quit;
原网站

版权声明
本文为[good_ boys]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202280534304237.html