Today we are going to show you how to install MySQL in a binary format:
Prepare to download the latest version in advance on the official website, then use the "RZ" command to import the source package into the virtual machine.
1, first before the installation should be checked in advance whether the system is installed
Rpm-qa mariadb
2. See if user MySQL already exists
Getent passwd MySQL
3, if there is no direct create MySQL user
useradd-d/app/mysqldb-r-m-s/sbin/nologin MySQL
When you are safe, it's best to check to see if you've created success
Getent passwd MySQL
650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M02/A7/4C/wKioL1nkquexJOBpAAAoL8rgZaQ573.png-wh_500x0-wm_ 3-wmp_4-s_1153291709.png "title=" Uc20171016200458.png "alt=" Wkiol1nkquexjobpaaaol8rgzaq573.png-wh_50 "/>
4, unzip the source package that was imported into the virtual machine and save it to its default path
Tar xvf mariadb-10.2.8-linux-x86_64.tar.gz-c/usr/local
5. Enter into the directory and create its soft connection
Cd/user/local
Ln-s Mariadb-10.2.8-linux-x86_64.tar.gz/mysql
6. Go to MySQL Directory
CD mysql/
Create a Directory
Mkdir/etc/mysql
CP SUPPORT-FILES/MY-HUGE.CNF/ETC/MYSQL/MY.CNF
650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M00/08/9D/wKiom1nkrdrSOZSBAAEXt3JbegI670.png-wh_500x0-wm_ 3-wmp_4-s_2363855045.png "title=" Uc20171016203328.png "alt=" Wkiom1nkrdrsozsbaaext3jbegi670.png-wh_50 "/>
7. Prepare the configuration file
Vim/etc/mysql/my.cnf
[Mysqld]
Datadir=/app/mysqldb
Innodb_file_per_table=on
Skip_name_resolve=on
650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M01/A7/4D/wKioL1nkq0OC8pKOAAB_oJDTh2w851.png-wh_500x0-wm_ 3-wmp_4-s_2259567907.png "title=" Uc20171016203230.png "alt=" Wkiol1nkq0oc8pkoaab_ojdth2w851.png-wh_50 "/>
8. Create a database file
cd/usr/local/mysql/
. scripts/mysql_install_db--user=mysql--datadir=/app/mysqldb
9. Prepare the service script and start the service
CP Support-files/mysql.server/etc/init.d/mysqld
Chkconfig--list MySQL
Chkconfig-add mysqld
Swrvice Start mysqld
There is a situation where the service does not come up because there is no log file
Create a log file and modify permissions
mkdir/var/log/mariadb/
Chown mysql/var/log/mariadb/
Service mysqld Start
Restarting the service at this point will succeed
10, MySQL is already installed, but this time MySQL has a security risk, for security purposes need to be safe to initialize:
Mysql_secure_installation
Then follow the prompts and go over it.
11, using the command: Mysql-uroot-p into MySQL
This time the binary MySQL has been installed successfully.
Installing MySQL in CENTOS7 binary format