CentOS 7 Installation MySQL Database
1. Now that the installation package, MySQL installation package is divided into Community Edition and Enterprise Edition, and this article will record the community version of the MySQL installation process, download the MySQL version as follows:
Mysql-5.7.16-linux-glibc2.5-x86_64.tar
Unzip the package will get the following two compressed package (good trouble ...) )
Mysql-5.7.16-linux-glibc2.5-x86_64.tar.gz
Mysql-test-5.7.16-linux-glibc2.5-x86_64.tar.gz
Here we only need to unzip the first compressed package, and then rename the unpacked compressed package to: MySQL, and then copy the folder to the/usr/local/directory;
2. Create the relevant user and file directory
Groupadd MySQL
Useradd-r-G MySQL MySQL (-r: Specify MySQL user as System user, no login required)
Modify/usr/local/mysql/Directory Permissions: (Enter directory: cd/usr/local/)
Chown-r MySQL mysql/
Chgrp-r MySQL mysql/
Create log directory and PID directory
Mkdir/var/log/mariadb
Mkdir/var/run/mariadb
And also modify the permissions for both directories, IBID. (/usr/local/mysql).
3. Initializing MySQL Database
Entry directory: Cd/usr/local/mysql/bin
./mysqld--user=mysql--basedir=/usr/local/mysql/--datadir=/usr/local/mysql/data/--initialize
After execution the following will appear, please record the last initial login password: j,+arkijr35-
A temporary password is generated for [email protected]: j,+arkijr35-
4. Start the service
Cp/usr/local/mysql/support-files/mysql.server/etc/init.d/mysql
Service MySQL Start
5. Problems encountered:
1): Service MySQL start failed
Failed to get Properties:access denied
Starting MySQL ... error! The server quit without updating PID file (/var/lib/mysql/localhost.pid).
Or
error! MySQL server PID file could not being found!
Starting MySQL ... error! The server quit without updating PID file (/var/lib/mysql/localhost.pid).
Workaround:
/usr/local/mysql/support-files/mysql.server restart
Or
Mv/etc/my.cnf/etc/my.cnf.bak
More content
6. Links
./mysql-u Root-p
mysql> SET PASSWORD = PASSWORD (' 123456 '); Change Password
7. Telnet
To open remote login permissions, please check the relevant content, for example:
GRANT all privileges on * * to ' root ' @ '% ' identified by ' 123456 ' with GRANT OPTION;
All root can be logged in remotely with a 123456 password.
CentOS 7 Installation MySQL Database