The previous article introduced the manual compilation installation of Apache, this article will continue the previous article that describes how to compile and install MySQL.
-
Second, compile and install MYCQL1. First unzip the MySQL file to the/opt directory.
tar zxvf/opt/lamp/mysql-5.5.24.tar.gz-c/opt/
2. Confirm the installation of GCC, gcc-c++, make, CMake Ncurses-devel, (character Terminal screen Control base library), bison, (parser), Libaio-devel (Support synchronous I/O) packages
Yum install gcc gcc-c++ make cmake-yrpm-ivh/mnt/package/ncurses-devel-5.7-3.20090208.el6.x86_64.rpmrpm-ivh/mnt/ package/bison-2.4.1-5.el6.x86_64.rpmrpm-ivh/mnt/package/libaio-devel-0.3.107-10.el6.x86_64.rpm
3. Add MySQL user to MySQL group
Useradd-s/sbin/nologin mysqlmkdir-p/usr/local/mysql4. Go to the MySQL installation directory cd/opt/mysql-5.5.245. configuration file
Cmake-dcmake_install_prefix=/usr/local/mysql
-dmysql_unix_addr=/home/mysql/mysql.sock
-ddefault_charset=utf8
-ddefault_collation=utf8_general_ci
-dwith_extra_charsets=all
-dwith_myisam_storage_engine=1
-dwith_innobase_storage_engine=1
-dwith_memory_storage_engine=1
-dwith_readline=1
-denabled_local_infile=1
6. Compiling and installing the software
Make && make install
If the error, empty the cache file can be
Find-name CMakeCache.txt
Rm-f./cmakecache.txt
7. Modify the main genus of MySQL files
chown-r Mysql.mysql/usr/local/mysql
8. Add Global Environment variables
Vim/etc/profile
Add export path= to the last line $PATH:/usr/local/mysql/bin/; (* refresh *\ on boot)
: Wq Save
Then reload the file to run
Source/etc/profile
9. Go to MySQL directory, copy my.cnf (config file), mysqld (startup script)
CP SUPPORT-FILES/MY-MEDIUM.CNF/ETC/MY.CNF
CP Support-files/mysql.server/etc/init.d/mysqld
10. Modify the permissions of the Mysqld startup script
chmod 755/etc/init.d/mysqld
Chkconfig--add/etc/init.d/mysqld
Chkconfig mysqld--level
Add the Mysqld service to the system service and set the boot from INIT3, init5
11. Initializing the database
/usr/local/mysql/scripts/mysql_install_db \
--user=mysql \
--ldata=/var/lib/mysql \
--basedir=/usr/local/mysql \
--datadir=/home/mysql
12. Establishing a soft connection
Ln-s/var/lib/mysql/mysql.sock/home/mysql/mysql.sock
13. Edit Mysqld startup script, set Basedir, DataDir directory
vi /etc/init.d/mysqld
Basedir=/usr/local/mysql
Datadir=/home/mysql
14. Turn on the MySQL service to see if it starts properly
Service mysqld Start
NETSTAT-TNL 3306
15. Go to the database and view all databases
mysql>show databases; #注意加分号
This interface shows that MySQL is already deployed, see the next chapter deploying PHP Services
Linux environment compiled and installed MySQL