Download Binary installation package
Because the binary installation package is already compiled, the path is already defined, the path is specified when unpacking, the default is:/usr/local/directory:
TARXVFMARIADB Bag c/usr/local/
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/08/9B/wKiom1nkl0CiNmEFAAAl0mt4wbE647.png "/>
When the unpacking is complete, the corresponding directory will be generated under that directory. You need to rename the directory or create a soft link that is named MySQL, which is written in the database configuration file.
ln-s corresponding directory MySQL
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/A7/4A/wKioL1nklIrxjL5hAACVDprRq1Q601.png "/>
When MySQL is installed, the account is created by default and is named MySQL. So you need to create a user, the user's home directory to store data files later.
useradd-d home directory/mysqldb-r-m-s/sbinloginmysql
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/08/9B/wKiom1nkl0Cx2UVLAABWlX43n68864.png "/>
(↑ NOTE: This directory will hold the database, it may become larger, so you need to have enough space, or on a separate disk)
To manually copy the configuration file. The profile is in a directory named Support-files after decompression:
There are many configuration files that are optimized for different scenarios:
MY-HUGE.CNF: Large environment
MY-LARGE.CNF: Large environment
MY-SMALL.CNF: Small Environment
MY-MEDIUM.CNF: Medium environment at compile time , the path to the configuration file has been specified, so one of these configuration files is copied to the specified path and modified to the specified name: my.cnf:/etc/mysql/directory. The directory is not available by default, so you need to create it manually:
Mkdir/etc/mysql
CPMY-XXX.CNF/ETC/MYSQL/MY.CNF
650) this.width=650; "Src=" http://s3.51cto.com/wyfs02/M02/A7/4A/ Wkiol1nkliqr1r22aaa84120cwk508.png "/>
After the configuration file has been copied, there may be some modifications in the configuration file, where: the definition below the
[mysqld] field:
datadir= path: Defines the data storage path for the database, which is the home directory of the user when the MySQL user was created,
Innodb_file_per_table=on:innodb is the database storage engine. Defines if this is used, each table holds a single file. On IS on. Not required)
Skip_name_resolve=on: Whether reverse parsing of IP is skipped. ( Can increase access speed, not required)
650) this.width=650; "title=" 18.png "alt=" Wkiom1nkncaxsywfaaaxjo1eloi611.png "src=" https://s2.51cto.com/wyfs02/M02 /08/9b/wkiom1nkncaxsywfaaaxjo1eloi611.png "/>
(↑ above the most critical to add DataDir)
After defining the data storage path, install with the CentOS CD, MySQL will have the system database and test database in this path and so on some files, now manually created directories, missing these files. However, after unpacking the binary installation package, a script is provided to automatically generate these databases and files, which are stored in:/ usr/local/mysql/scripts/directory, but do not enter this directory, need to run in the MySQL directory, and you need to specify the MySQL user to execute the command, and then specify the data storage path otherwise error:
scripts/mysql_install_db--user=mysql--datadir=/Data Storage Path
(note, to specify the user and data storage path to execute.) (This path is the path set in the configuration file and is also the home directory of the MySQL user).)
650) this.width=650; "title=" 20.png "alt=" Wkiol1nkmyaxy0bsaaawvizwjla794.png "src=" https://s3.51cto.com/wyfs02/M02 /a7/4b/wkiol1nkmyaxy0bsaaawvizwjla794.png "/>
The service script for the service is available under the mysql/support-files/directory:
Mysql.server. It needs to be placed in a specific directory and renamed to MYSQLD (renaming is not required):
CP Support-files/mysql.server/etc/init.d/mysqld
650) this.width=650; "title=" 34.png "alt=" Wkiom1nknoczwj6naaasownwymc913.png "src=" https://s2.51cto.com/wyfs02/M01 /08/9b/wkiom1nknoczwj6naaasownwymc913.png "/>
650) this.width=650; "title=" 21.png "alt=" Wkiol1nkmz_gb1vsaaa2vkbj7go633.png "src=" https://s5.51cto.com/wyfs02/M01 /a7/4b/wkiol1nkmz_gb1vsaaa2vkbj7go633.png "/> (↑centos7 can still be placed in this directory, old management service methods can also be used)
Chkconfig--add mysqld: Add the service to power on or off, the Chkconfig command can be used to control
650) this.width=650; "title=" 50.png "alt=" Wkiom1nknxwtfsamaabvrsnqgw8087.png "src=" https://s1.51cto.com/wyfs02/M02 /08/9b/wkiom1nknxwtfsamaabvrsnqgw8087.png "/>
The service mysqld start can then be started, but now the boot will be error, because the MySQL log file is also missing:
CENTOS7 Hint: The Var/log/mariadb/mariadb.log file is missing, but the MARIADB directory does not exist, so you need to create the directory before creating the. log file
650) this.width=650; "title=" 51.png "alt=" Wkiom1nknayt2wkpaaaqbox-rvg989.png "src=" https://s4.51cto.com/wyfs02/M02 /08/9b/wkiom1nknayt2wkpaaaqbox-rvg989.png "/>
CENTOS6 hint: Missing Var/log/mysql.log file, directly under var/log/directly create the file can be
Start the service
650) this.width=650; "title=" 52.png "alt=" Wkiom1nknercahoxaaafbf6af_g004.png "src=" https://s1.51cto.com/wyfs02/M00 /08/9c/wkiom1nknercahoxaaafbf6af_g004.png "/>
Add the path of MySQL to the path variable
650) this.width=650; "title=" 53.png "src=" https://s4.51cto.com/wyfs02/M02/08/9C/ Wkiom1nknl3hywg4aaalouh5zbq029.png "alt=" Wkiom1nknl3hywg4aaalouh5zbq029.png "/>
For security reasons, you need to run a security script
650) this.width=650; "title=" 54.png "src=" https://s3.51cto.com/wyfs02/M01/08/9C/wKiom1nkntKzvoCXAACyV_ Eyisk174.png "alt=" Wkiom1nkntkzvocxaacyv_eyisk174.png "/>650" this.width=650; "title=" 55.png "src=" https:// S4.51cto.com/wyfs02/m02/08/9c/wkiom1nknubthr74aaclll6j090226.png "alt=" Wkiom1nknubthr74aaclll6j090226.png "/> 650) this.width=650; "title=" 56.png "src=" https://s1.51cto.com/wyfs02/M02/08/9C/ Wkiom1nknvabsvgqaabpyxrmmyc994.png "alt=" wkiom1nknvabsvgqaabpyxrmmyc994.png "/> This way, the binary installation mysql|mariadb is complete.
This article is from the "13007865" blog, please be sure to keep this source http://13017865.blog.51cto.com/13007865/1972959
Binary installation mysql|mariadb