MySQL is a true multi-threaded, multi-user SQL database service, which is now operated and maintained by Oracle Corporation.
One, prepare for work.
1, in order to avoid the occurrence of port conflicts, program conflicts, it is recommended to query the installation of MySQL software, verify that there is no RPM installation of Mysql-server, MySQL package, otherwise it is recommended to uninstall.
Use command: rpm-q mysql-server mysql//query for MySQL installation software and services
RPM-E MySQL--nodeps//uninstall MySQL software program
650) this.width=650; "src=" http://s4.51cto.com/wyfs02/M00/78/A3/wKioL1aArd7xB8ijAAAt283MUDE261.jpg "title=" 1.jpg " alt= "Wkiol1aard7xb8ijaaat283mude261.jpg"/>
650) this.width=650; "src=" http://s4.51cto.com/wyfs02/M00/78/A3/wKioL1aAruuDIi5YAAAyAcsbAwY680.jpg "title=" 2.jpg " alt= "Wkiol1aaruudii5yaaayacsbawy680.jpg"/>
2, install the Ncurses-devel package, the system CD-ROM comes with.
650) this.width=650; "src=" http://s5.51cto.com/wyfs02/M00/78/A5/wKiom1aAsNrDYXjlAAAlacmPMLc992.jpg "title=" 3.jpg " alt= "Wkiom1aasnrdyxjlaaalacmpmlc992.jpg"/>
3,mysql 5.5 requires a cmake compilation installation, so install the CMake package.
Using the command: Tar zxf camake-2.8.12.tar.gz-c/usr/src/
cd/usr/src/cmake-2.8.12/
./configure && gmake && gmake Install
650) this.width=650; "src=" http://s1.51cto.com/wyfs02/M00/78/A5/wKiom1aAsnvBdD27AAAw1dB_mU0294.jpg "title=" 4.jpg " alt= "Wkiom1aasnvbdd27aaaw1db_mu0294.jpg"/>
Two. Source code compilation and installation
1. Create a running user
Using the command: Groupadd MySQL//create a group named MySQL
Useradd-m-s/sbin/nologin-g MySQL//create a user named MySQL and join the MySQL group,-M does not establish the host directory,-s Specifies the user's login Shell-/sbin/nologin.
650) this.width=650; "src=" http://s1.51cto.com/wyfs02/M02/78/A4/wKioL1aAxYuQqy0MAAAhJtXKl78130.jpg "title=" 5.jpg " alt= "Wkiol1aaxyuqqy0maaahjtxkl78130.jpg"/>
2, unpacking
Using the command: Tar zxf mysql-5.5.38.tar.gz-c/usr/src/
cd/usr/src/mysql-5.5.38/
650) this.width=650; "src=" http://s1.51cto.com/wyfs02/M00/78/A6/wKiom1aAxiPjYpLsAAAmgTRonEE858.jpg "title=" 6.jpg " alt= "Wkiom1aaxipjyplsaaamgtronee858.jpg"/>
3, configuration
Use command: cmake-dcmake_install=/usr/local/mysql-dsysconfidir=/etc-ddefault_charset=utf8-ddefault_collation=utf8_ General_ci-dwith_extra_charsets=all
650) this.width=650; "src=" http://s4.51cto.com/wyfs02/M00/78/A6/wKiom1aAyMLynRHNAABFLHuA4cs517.jpg "title=" 7.jpg " alt= "Wkiom1aaymlynrhnaabflhua4cs517.jpg"/>
4, compiling and installing
Use the command: Make && make install
650) this.width=650; "src=" http://s2.51cto.com/wyfs02/M01/78/A4/wKioL1aAydOj2QkcAAAQHoKndeM149.jpg "title=" 8.jpg " alt= "Wkiol1aaydoj2qkcaaaqhokndem149.jpg"/>
Three, after the installation of the adjustment
1. Set permissions on the database directory
Use command: Chown-r mysql:mysql/usr/local/mysql
650) this.width=650; "src=" http://s4.51cto.com/wyfs02/M00/78/A8/wKioL1aA6hDRCeuEAAAary8kBLw101.jpg "title=" 9.jpg " alt= "Wkiol1aa6hdrceueaaaary8kblw101.jpg"/>
2. Create a configuration file
In the MySQL source directory in the Support-files folder, provides a suitable for different load database sample files, generally choose My-medium.cnf file.
Use the command: rm-rf/etc/my.cnf//Delete the previous configuration file
CP SUPPORT-FILES/MY-MEDIUM.CNF/ETC/MY.CNF
650) this.width=650; "src=" http://s1.51cto.com/wyfs02/M00/78/A8/wKioL1aA662hmfROAAAiPBhFIVI508.jpg "title=" 10.jpg "alt=" Wkiol1aa662hmfroaaaipbhfivi508.jpg "/>
3, initializing the database
Use command:/usr/local/mysql/scripts/mysql_install_db--user=mysql--basedir=/usr/local/mysql--datadir=/usr/local/mysql /data/
650) this.width=650; "src=" http://s1.51cto.com/wyfs02/M00/78/AA/wKiom1aA7a6QeTwTAAA0ZQTwGoI558.jpg "title=" 11.jpg "alt=" Wkiom1aa7a6qetwtaaa0zqtwgoi558.jpg "/>
4, setting environment variables
To facilitate the use of MySQL commands in any directory, you need to set environment variables in/etc/profile.
Use command: Echo "path= $PATH:/usr/local/mysql/bin" >>/etc/profile
. /etc/profile
650) this.width=650; "src=" http://s2.51cto.com/wyfs02/M01/78/A9/wKioL1aA7xuAJHvwAAA-RPtv-3Y699.jpg "title=" 12.jpg "alt=" Wkiol1aa7xuajhvwaaa-rptv-3y699.jpg "/>
Four, add system service
Locate the Mysql.server script file under the Support-files folder in the source package, copy it to/etc/rc.d/init.d/mysql, and rename it to Mysqld, The Execute permission is then set to be added as a mysqld system service through the Chkconfig command.
Use command: CP support-files/mysql.server/etc/rc.d/init.d/mysqld
chmod + x/etc/rc.d/init.d/mysql
Chkconfig--add mysqld
650) this.width=650; "src=" http://s2.51cto.com/wyfs02/M00/78/A9/wKioL1aA8NeD4AkGAABCqykMruI102.jpg "title=" 13.jpg "alt=" Wkiol1aa8ned4akgaabcqykmrui102.jpg "/>
Start the service test to see the current status of the service and the port usage.
MySQL consumes 3306 ports on TCP.
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/78/A9/wKioL1aA8b_g0LFcAABzZS8opqM845.jpg "title=" 14.jpg "alt=" Wkiol1aa8b_g0lfcaabzzs8opqm845.jpg "/>
This article is from the "New Start" blog, so be sure to keep this source http://yuanshuai.blog.51cto.com/10539781/1729231
Installation of MySQL database System instance in Linux environment