Several common installation packages for MySQL: RPM. Source package, binary compiler-free installation
We are now talking about binary-free compiler package installation
We'll go to the/usr/local/src first (usually the downloaded stuff will be put here)
wget http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz
wget is the download command
TAR-ZXVF Unzip the bag.
The extracted is the blue MySQL
After unpacking, we changed the package name to MySQL and put it under/usr/local (because the name is very long with version)
Then we go to this directory and create a MySQL user after
Useradd MySQL
Create a data directory (MySQL-hosted)
and initialize it to generate/data/mysql
./scripts/mysql_install_db--user=mysql--datadir=/data/mysql
This time there will be an error, saying that relies on a module, this time we can use the Yum list plus grep to search
The first package is, if not, we can try each one of these bags.
After performing the initialization, we can execute the next command with echo $ after the command is completed. To test, if it's 0, it's normal.
If it was 1, there would be some problems.
After initialization is complete, copy the configuration file and startup script
Configuration file here in/usr/local/mysql/support-files/my-default.cnf
We copied him to/etc/and renamed to MY.CNF, (can also be placed in other directories, but you have to know where to put, and then fill in the path to write in) in fact, our system itself is a my.cnf can actually be used but to modify
Path to the DataDir and socket path
The rest of the first without the tube, and then meet the demand to increase
Another one is the startup script, and it's in mysql/support-files/.
Cp/usr/local/mysql/support-files/mysql.server/etc/init.d/mysqld
We'll copy it to//etc/init.d/and rename it to Mysqld.
Change to the corresponding path
And then give permission 755, but the default is 755 we don't have to give
If you want to start from
Chkconfig--add mysqld
Need to be added to the startup item
We can start it manually and view the processes that can be
View Port 3306 Yes
Which commands we start with the command line
/usr/local/mysql/bin/mysqld_safe--defaults-file=/etc/my.cnf--user=mysql--datadir=/data/mysql &
But if you want to close it, you can't use stop.
Only Killall
Killall is a more secure method because MySQL reads and writes relatively large direct kill has the potential to lose data
Killall Stop the current read and write operations, and then write the unfinished data to the disk and then kill the process
When we killall kill the MySQL process has not been displayed, this time killall in the data stored in the disk, this time we can not be forced to delete with kill, slowly wait, otherwise it will lose data, serious damage to the database table
MySQL: Binary Compiler-free installation