Pipeline [root @ rhel5local] # cdcmake-2.8.4 [root@rhel5cmake-2.8.4] #. confi
1.hypothetical mysql-5.5.10.tar.gzto and cmake-2.8.4.tar.gz two source files (1) install cmake first (mysql5.5 is compiled through cmake) [root @ rhel5 local] # tar-zxv-f cmake-2.8.4.tar.gz [root @ rhel5 local] # cd cmake-2.8.4 [root @ rhel5 cmake-2.8.4] #. /confi
1.hypothetical two source files: mysql-5.5.10.tar.gzand cmake-2.8.4.tar.gz
(1) install cmake first (after mysql5.5 is compiled through cmake)
[root@ rhel5 local]#tar -zxv -f cmake-2.8.4.tar.gz[root@ rhel5 local]#cd cmake-2.8.4[root@ rhel5 cmake-2.8.4]#./configure[root@ rhel5 cmake-2.8.4]#make[root@ rhel5 cmake-2.8.4]#make install
(2) Create the mysql installation directory and database storage directory
[Root @ rhel5 ~] # Mkdir-p/usr/local/mysql // install mysql [root @ rhel5 ~] # Mkdir-p/usr/local/mysql/data // store the database
(3) create mysql users and user groups
[root@ rhel5~]groupadd mysql[root@ rhel5~]useradd -r -g mysql mysql
(4) install mysql
[root@ rhel5 local]#tar -zxv -f mysql-5.5.10.tar.gz[root@ rhel5 local]#cd mysql-5.5.10[root@ rhel5 mysql-5.5.10]#cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql-DMYSQL_DATADIR=/usr/local/mysql/data-DDEFAULT_CHARSET=utf8-DDEFAULT_COLLATION=utf8_general_ci
-DEXTRA_CHARSETS=all -DENABLED_LOCAL_INFILE=1[root@ rhel5 mysql-5.5.10]#make[root@ rhel5 mysql-5.5.10]#make install
Parameter description:
-DCMAKE_INSTALL_PREFIX =/usr/local/mysql // installation directory
-DINSTALL_DATADIR =/usr/local/mysql/data // database storage directory
-DDEFAULT_CHARSET = utf8 // use the utf8 character
-DDEFAULT_COLLATION = utf8_general_ci // check the character
-DEXTRA_CHARSETS = all // install all extended character sets
-DENABLED_LOCAL_INFILE = 1 // allow local data import
Note:
During re-compilation, you need to clear the old object file and cache information.
# Make clean
# Rm-f CMakeCache.txt
# Rm-rf/etc/my. cnf
2. Configuration
(1) Set Directory Permissions
[Root @ rhel5 ~] # Cd/usr/local/mysql [root @ rhel5 mysql] # chown-R root: mysql. // set the owner of all files in the current directory to root and the group to mysql [root @ rhel5 mysql] # chown-R mysql: mysql data
(2)
[Root @ rhel5 mysql] # cp support-files/my-medium.cnf/etc/my. cnf // Add mysql startup service to System Service
(3) create a table for the system database
[root@ rhel5 mysql]# cd /usr/local/mysql[root@ rhel5 mysql]# scripts/mysql_install_db --user=mysql
(4) set Environment Variables
[Root @ rhel5 ~] # Vi/root /. bash_profile In PATH = $ PATH: $ HOME/bin Add the parameter: PATH = $ PATH: $ HOME/bin:/usr/local/mysql/bin: /usr/local/mysql/lib [root @ rhel5 ~] # Source/root/. bash_profile
(5) manually start mysql
[Root @ rhel5 ~] # Cd/usr/local/mysql [root @ rhel5 mysql] #. /bin/mysqld_safe -- user = mysql & // start MySQL, but the startup log cannot be stopped and written under this file:/usr/local/mysql/data/localhost. err closes the MySQL service [root @ rhel5 mysql] # mysqladmin-u root-p shutdown // here, the MySQL root User has not configured a password, so it is null. When you need to enter the password, click the Enter key.
(6) Another simple method for starting mysql (mysql has been added to the system service)
[root@ rhel5~]# service mysql.server start [root@ rhel5~]# service mysql.server stop[root@ rhel5~]# service mysql.server restart
If the preceding command appears: mysql. server does not recognize other services
Maybe mysql has not been added to the system service, and you can add it in another way:
[Root @ rhel5 mysql] # cp support-files/mysql. server/etc/init. d/mysql // Add the mysql startup service to the System Service
Note: Copy mysql. server to/etc/init. d and name it mysql. In some systems, mysql. server in/usr/local/mysql/share/mysql. server, and mysql in the system. server in/usr/local/mysql/support-files/mysql. server.
Then start mysql with # service mysql start.
(7) modify the password of the root user of MySQL and enable remote connection.
[Root @ rhel5 ~] # Mysql-u root mysqlmysql> use mysql; mysql> desc user; mysql> grant all privileges on *. * TO root @ "%" identified by "root"; // Add the remote connection capability TO the root user. Mysql> update user set Password = password ('xxxxxx') where User = 'root'; mysql> select Host, User, Password from user where User = 'root '; mysql> flush privileges; mysql> exit to log on again: mysql-u root-p if remote connection is not available, disable firewall [root @ rhel5 ~] #/Etc/rc. d/init. d/iptables stop
Note: If the remote connection fails and the mysql error number 1130 is displayed, add the following statement:
Mysql> grant all privileges on *. * TO 'root' @ '% 'identified BY' ****** 'with grant option;