Linux Environment: CentOS 6.5
MySQL version: 5.5.20, attached: "Click to download"
1, installation CMake
MySQL has been removed from version 5.5, and is replaced by the CMake tool./configure.
Therefore, we first need to compile and install the CMake tool in the system source code.
Download CMake
[Email protected] soft]# wget http://www.cmake.org/files/v2.8/cmake-2.8.4.tar.gz
Extract
[Email protected] soft]# tar zxvf cmake-2.8.4.tar.gz
[[Email protected] soft]# CD Cmake-2.8.4[[email protected] cmake-2.8.4]#./configure[[email protected] cmake-2.8.4]# Make && make install
2. Ensure that the following required system packages have been installed
by Rpm-qa | grep name verifies that the following packages are all installed.
gcc* gcc-c++* autoconf* automake* zlib* libxml* ncurses-devel* libgcrypt* libtool*
If a related package is missing, it can be installed online via yum-y install, or directly from the system installation CD and installed by RPM-IVH.
3, the system test before installation
Build MySQL installation directory and data storage directory
[Email protected] cmake-2.8.4]# mkdir-p/usr/local/mysql5.5.20
Create users and user groups
[[email protected] cmake-2.8.4]# Groupadd MySQL
[[email protected] cmake-2.8.4]# useradd-g MySQL MySQL
Assigning permissions to the data store directory
[Email protected] mysql-5.5.20]# chown mysql:mysql-r/usr/local/mysql5.5.20/
4. Compile and install MySQL5.5.20
[[Email protected] soft]# tar zxvf mysql-5.5.20.tar.gz[[email protected] soft]# CD mysql-5.5.20<strong></ Strong>
cmake-dcmake_install_prefix=/usr/local/mysql5.5.20/-dsysconfdir=/etc/-dmysql_datadir=/usr/local/mysql5.5.20/ data/-dmysql_tcp_port=3306-dmysql_unix_addr=/tmp/mysqld.sock-dmysql_user=mysql-dextra_charsets=all-dwith_ Readline=1-dwith_ssl=system-dwith_embedded_server=1-denabled_local_infile=1-dwith_innobase_storage_engine=1- Dwith_ssl=bundled
errors that may occur:
Workaround:
[email protected] mysql-5.5.20]# Yum Install Bison
Workaround:
Remove-dmysql_user=mysql
[[email protected] mysql-5.5.20]# Make[[email protected] mysql-5.5.20]# make install
Initializing the database
Need to assign scripts/mysql_install_db file execution permissions before execution
[Email protected] mysql-5.5.20]# chmod 755 scripts/mysql_install_db[[email protected] mysql-5.5.20]# Scripts/mysql_ install_db--user=mysql--basedir=/usr/local/mysql5.5.20/--datadir=/usr/local/mysql5.5.20/data/
Create a shell script that manages the MySQL database
[[email protected] mysql-5.5.20]# Mkdir/usr/local/mysql5.5.20/init.d[[email protected] mysql-5.5.20]# CP Support-files/mysql.server/usr/local/mysql5.5.20/init.d/mysql
To give the shell script executable permissions:
[Email protected] mysql-5.5.20]# chmod +x/usr/local/mysql5.5.20/init.d/mysql
Start MySQL
[[email protected] mysql-5.5.20]#/usr/local/mysql5.5.20/init.d/mysql start
If startup fails, please refer to http://blog.csdn.net/zalion/article/details/9274263
My workaround is to:
[Email protected] mysql]# Rm-rf/var/lock/subsys/mysql
Managing the MySQL server from the command line
[Email protected] mysql5.5.20]#/usr/local/mysql5.5.20/bin/mysql
Set the initial password for the root account
[Email protected] mysql5.5.20]#/usr/local/mysql5.5.20/bin/mysqladmin-u root password ' 123456 '
Go to command line MySQL
[Email protected] mysql5.5.20]#/usr/local/mysql5.5.20/bin/mysql-u root-p123456
Remove the empty password account for the native anonymous connection
mysql> use mysql;mysql> Delete from user where password= ';mysql> flush privileges;mysql> Select Host,user,pa ssWOrd from User;mysql> exit
Linux Source Compilation Installation MySQL 5.5.x