Installation and use mysql under Linux

(Note: the installation and use are the same person in centos7)

1. Install wget

1 yum install wget

2. Download the installation package mysql

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

3. Install MySQL (where each different speeds, different installation time)

1 rpm -ivh mysql57-community-release-el7-8.noarch.rpm
1 yum install mysql-server

4. Start mysql service mysql service will be set to boot

1 service mysqld start
1 chkconfig mysqld on

5. When the first start MySQL server, MySQL generates a temporary password for the root. You can find the password by running the following command:

1 grep 'temporary password' /var/log/mysqld.log

If this file is empty:
Data remaining mysql delete the original installation had a (This step is very important, the problem lies in this)

1 rm -rf /var/lib/mysql

b. Restart mysqld services

1 service mysqld restart

c. look for a temporary password

6. Log mysql

1 mysql -u root -p

Then enter the temporary password you just looking, successful login

7. Change Password

1  set password for root@localhost = password('Root123!');

Here's password must format should contain sensitive subtitles and special characters

8. Open the 3306 port

. 1  ## Centos7 firewall to open the port number
 2 Firewall-cmd = --zone public --add-Port = 3306 / TCP - Permanent
 3   
. 4  # 3 line is the parameter description below
 . 5  # # -zone scope
 . 6 # -add- = port 80 / tcp # Add port, the format is: port / protocol
 7  # # -permanent permanent, this argument does not fail after the restart
 8   
9  after restarting the firewall to see if the entry into force of #
 10 firewall-cmd - reload # restart firewall
 11 firewall-cmd --list- the ports already open ports # View
 12   
13   
14  # If you want to permanently stop the firewall, perform the following operation
 15  systemctl sTOP stop firewall firewalld.service #
16  systemctl disable firewall boot prohibited firewalld.service #
 17   
18  # to view the status of the firewall
 19 firewall-cmd --state # view the default firewall status (closed after displaying notrunning, display running after opening

Thus the complete installation under linux mysql, mysql next step is the process of building a database built operating table, and are not described here temporarily

 

Guess you like

Origin www.cnblogs.com/vegeta-xiao/p/11639680.html