In real-world applications, most companies will typically compile and install MySQL
:http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.22.tar.gz/
System environment: CentOS 6.7 Finall
1, install the required dependency package
Yum Install-y ncurses-devel.x86_64
Yum Install-y cmake.x86_64
Yum Install-y libaio.x86_64
Yum Install-y bison.x86_64
Yum Install-y gcc-c++.x86_64
If you cannot install Yum, you can hang it on the CD or locate the appropriate installation package.
2, installation
[[email protected] local] #groupadd MySQL
[[email protected] mysql-5.6.22] #seradd-g MySQL MySQL
[email protected] local] #Tar-XVF mysql-5.6.22.tar.gz
[[email protected] local] #cd/mysql-5.6.22
[[email protected] mysql-5.6.22] #kdir /usr/local/mysql -- Create the installation path
[[email protected] mysql-5.6.22] #kdir /usr/local/mysql/data --- Create a database file path
[[email protected] mysql-5.6.22] #cmake. -dcmake_install_prefix=/usr/local/mysql -dmysql_datadir=/usr/local/mysql/data -DWITH_INNOBASE_ storage_engine=1-dmysql_unix_addr==/usr/local/mysql/mysql.sock-dmysql_user=mysql-ddefault_charset= Utf8-ddefault_collation=utf8_general_ci
The normal situation is completed successfully, if an error occurs, please find the cause of the problem according to the actual error.
Then Make,make install.
[[email protected] mysql-5.6.22] #ake && make install
MySQL will be installed by default in the specified/usr/local/mysql directory
3, initialize the data
[[email protected] mysql-5.6.22] #d/usr/local/mysql
[email protected] mysql-5.6.22]# scripts/mysql_install_db--user=mysql--basedir=/usr/local/mysql--datadir=/home/data/mysql/ DATA--DEFAULTS-FILE=/USR/LOCAL/MYSQL/MY.CNF
After the data has been initialized for completion, follow the instructions for the document operation.
4,mysql Database Run environment configuration
[[email protected] local] #cd/usr/local/mysql
[[email protected] MySQL] #cp support-files/my-default.cnf/etc/my.cnf
[[email protected] MySQL] #chown mysql:mysql/etc/my.cnf
[[email protected] MySQL] #chmod-R 700/etc/my.cnf
[[email protected] MySQL] #cp support-files/mysql.server/etc/init.d/mysqld
[[email protected] MySQL] #chmod-R 700/etc/init.d/mysqld
[[email protected] MySQL] #chown mysql:mysql /etc/init.d/mysqld
[[email protected] MySQL] #chown mysql:mysql/usr/local/mysql
[[email protected] MySQL] #echo "Export path= $PATH:/usr/local/mysql/bin" >>/etc/profile
[[email protected] MySQL] #source/etc/profile
[[email protected] MySQL] #vi/etc/my.cnf--Modify it into some content
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/79/B7/wKiom1aYw3GizkJ7AABlOLr2NM4093.png "title=" Mysql.png "alt=" Wkiom1ayw3gizkj7aablolr2nm4093.png "/>5, start MySQL service
[[email protected] mysql]#/etc/init.d/mysqld start
CMake Compiling and installing MySQL