First, create the installation directory
Centos account in the switch to the root account, the next local directory
1 cd /usr/local
You can view some files in the current directory ls command to create a directory where mysql installation files in this directory
1 ls 2 3 mkdir mysql 4 5 ls
Then switch to the directory mysql
1 cd mysql
Second, download mysql
1 wget https://repo.mysql.com//mysql80-community-release-el7-1.noarch.rpm
Third, the installation
1 yum -y localinstall mysql80-community-release-el7-1.noarch.rpm
Results of the above as shown below:
Installation mysql-community-release-el7-1.noarch.rpm package
Enter the command:
1 sudo rpm -ivh mysql80-community-release-el7-1.noarch.rpm
To Is this ok [y / d / N] This step is to select the input y, then Enter to continue; download time may be here a little longer, according to individual network circumstances, encounters Is this ok [y / N] or select Input y, then continues the transport;
Fourth, the service is installed, start
1 start mysql command: 2 systemctl Start mysqld
. 3 boot command: . 4 systemctl enable mysqld . 5 systemctl daemon - reload
Fifth, password settings
Get the default password
1 grep 'temporary password' /var/log/mysqld.log
Can generate a random default password, you can use this password database;
change Password:
1 the ALTER the USER ' root ' @ ' localhost ' IDENTIFIED BY ' your password (with case, numbers and special characters) ' ;
Here strict password requirements, otherwise it will error;
Sixth, authorized remote landing
Create a user:
. 1 the CREATE the USER ' the root ' @ ' % ' the IDENTIFIED BY ' password set above ' ;
Authorization:
1 GRANT ALL ON *.* TO 'root'@'%' WITH GRANT OPTION;
Seven, update the root password
It should update the root password, otherwise it will report 2058 errors when connecting to the database;
. 1 the ALTER the USER ' the root ' @ ' % ' the IDENTIFIED the WITH mysql_native_password BY ' disposed above password ' ;
Eight, port settings
View Port:
1 show global variables like 'port';
You can see the corresponding port numbers:
Modify the port:
. 1 . 1 , edit / etc / the my.cnf file [ the root @ localhost ~ ] # VI / etc / the my.cnf 2 . 3 2 , was added Port = 2032 ; . 4 . 5 . 3 , restart MySQL [ the root @ localhost ~ ] # / etc / init.d / mysqld restart