Download mysql package
Http://dev.mysql.com/downloads/mysql/
Http://download.softagency.net/MySQL/Downloads/MySQL-5.5/
Create a mysql installation directory
[Root @ dianzhui ~] # Mkdir/usr/local/mysql5.5.12/
Create a mysql account
[Root @ dianzhui ~] # Adduser
......
Create a data directory
[Root @ dianzhui ~] # Mkdir/var/mysql
[Root @ dianzhui ~] # Chown mysql. mysql-R/var/mysql
Install cmake
Use ports to install cmake
Install mysql 5.5.9
[Root @ dianzhui ~] # Tar zxvf mysql-5.5.12.tar.gz
[Root @ dianzhui ~] # Cd mysql-5.5.12
[Root @ dianzhui mysql-5.5.12] # cmake ./
-DCMAKE_INSTALL_PREFIX =/usr/local/mysql5.5.12 //
-DMYSQL_DATADIR =/var/mysql/
-DMYSQL_UNIX_ADDR =/var/mysql/mysqld. sock/
-DWITH_INNOBASE_STORAGE_ENGINE = 1/
-DENABLED_LOCAL_INFILE = 1/
-DMYSQL_TCP_PORT = 3306/
-DEXTRA_CHARSETS = all/
-DDEFAULT_CHARSET = utf8/
-DDEFAULT_COLLATION = utf8_general_ci/
-DMYSQL_UNIX_ADDR =/var/mysql. sock/
-DMYSQL_USER = mysql/
-DWITH_DEBUG = 0
Note: It is best to remove the following two lines to avoid coding errors.
-DDEFAULT_CHARSET = utf8/
-DDEFAULT_COLLATION = utf8_general_ci/
[Root @ dianzhui mysql-5.5.12] # make
[Root @ dianzhui mysql-5.5.12] # make install
Copy the configuration file
[Root @ dianzhui mysql-5.5.12] # cp support-files/my-medium.cnf/usr/local/etc/my. cnf
Copy the Startup Script
[Root @ dianzhui mysql-5.5.12] # cp support-files/mysql. server/usr/local/etc/rc. d/mysqld
[Root @ dianzhui mysql-5.5.12] # chmod 755/usr/local/etc/rc. d/mysqld
Initialize the database (go to the installation directory)
[Root @ dianzhui mysql-5.5.12] # cd/usr/local/mysql5.5.12
[Root @ dianzhui mysql5.5.12] # scripts/mysql_install_db -- user = mysql -- basedir =/usr/local/mysql5.5.12 -- datadir =/var/mysql/
Start Database
[Root @ dianzhui mysql5.5.12] #/usr/local/etc/rc. d/mysqld start
Change root Password
[Root @ kevin mysql5.5.12] #/usr/local/mysql5.5.12/bin/mysqladmin-u root password 'new-password'
If an error occurs during startup, go to the database directory to view the error log.
Copy to Environment Variable
Cp mysql mysqladmin mysqld_safe mysqldump/usr/sbin/
Adding the startup Item File
[Root @ Kevin mysql5.5.12] # Vim/etc/rc. conf
Mysql_enable = "yes"
Mysql_dbdir = "/var/MySQL"
Reference, pig:
Select profile description: http://www.workle.cn/space.php? Uid = 1 & Do = Blog & id = 336.
Compile and install MySQL 5.5.9: http://crazyming.blog.51cto.com/1048571/510659