Source code compilation and installation of MySQL 5.5.30
0. Install cmake
[Root @ www.bkjia.com ~] # Tar-zxvf cmake-2.8.11.2.tar.gz
[Root @ www.bkjia.com cmake-2.8.11.2] #./configure
[Root @ www.bkjia.com cmake-2.8.11.2] # make
[Root @ www.bkjia.com cmake-2.8.11.2] # make install
1. Add mysql users and groups
[Root @ www.bkjia.com ~] # Groupadd mysql
[Root @ www.bkjia.com ~] # Useradd-g mysql
2. Compile the MySQL Program
[Root @ www.bkjia.com tar_mysql] # tar-zxvf mysql-5.5.30.tar.gz
[Root @ www.bkjia.com ~] # Cd mysql-5.5.30/
/Usr/local/bin/cmake \
-DCMAKE_INSTALL_PREFIX =/usr/local/mysql5.5 \
-DMYSQL_UNIX_ADDR =/tmp/mysql. sock \
-DDEFAULT_CHARSET = utf8 \
-DDEFAULT_COLLATION = utf8_general_ci \
-DWITH_EXTRA_CHARSETS: STRING = utf8, gbk, gb2312 \
-DWITH_MYISAM_STORAGE_ENGINE = 1 \
-DWITH_INNOBASE_STORAGE_ENGINE = 1 \
-DWITH_READLINE = 1 \
-DENABLED_LOCAL_INFILE = 1 \
-DMYSQL_DATADIR =/home/mysql/data \
-DWITH_DEBUG = 0
[Root @ www.bkjia.com mysql-5.5.30] # make & make install
3. Copy and modify the database configuration file.
[Root @ www.bkjia.com ~] # Cp-ar/usr/local/mysql5.5/support-files/my-medium.cnf/usr/local/mysql5.5/etc/lyq314.cnf
4. initialize the database
/Usr/local/mysql5.5/scripts/mysql_install_db -- defaults-file =/usr/local/mysql5.5/etc/lyq314.cnf -- basedir =/usr/local/mysql5.5/-- datadir =/home /mysql/data -- user = mysql
5. Add Environment Variables
[Root @ www.bkjia.com ~] # Echo "export PATH = $ PATH:/usr/local/mysql5.5/bin">/etc/profile
[Root @ www.bkjia.com ~] # Source/etc/profile
6. Start mysql
/Usr/local/mysql5.5/bin/mysqld_safe -- defaults-file =/usr/local/mysql5.5/etc/lyq314.cnf -- datadir =/home/mysql/data -- user = mysql &
7. view the mysql service port
# Netstat-tunlp
[Root @ localhost etc] # netstat-nltp | grep 3306
Tcp 00 0.0.0.0: 3306 0.0.0.0: * LISTEN24752/mysqld
8. Set the administrator password.
/Usr/local/mysql5.5/bin/mysqladmin-u root password '1q2w3e4r'
#/Usr/local/mysql5.5/bin/mysqladmin-u root-p1q2w3e4r password '123'
9. log on to the database for testing
[Root @ www.bkjia.com mysql-5.5.30] #/usr/local/mysql5.5/bin/mysql-uroot-p
Enter password:
Welcome to the MySQL monitor. Commands end with; or \ g.
Your MySQL connection id is 11
Server version: 5.5.30-log Source distribution
Copyright (c) 2000,201 3, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
Affiliates. Other names may be trademarks of their respective
Owners.
Type 'help; 'or' \ H' for help. type' \ C' to clear the current input statement.
Mysql> show databases;
+ -------------------- +
| Database |
+ -------------------- +
| Information_schema |
| Mysql |
| Performance_schema |
| Test |
+ -------------------- +
4 rows in set (0.02 sec)
Mysql>
10. Disable MySQL
[Root @ www.bkjia.com mysql-5.5.30] #/usr/local/mysql5.5/bin/mysqladmin-uroot-p shutdown
Enter password:
130717 00:31:09 mysqld_safe mysqld from pid file/home/mysql/data/lyq314.pid ended
Three major installation methods for MySQL 5.5: [binary, source code compilation, and RPM package] installation steps and comparison of advantages and disadvantages