1, for the CentOS system, you first need to uninstall its own MySQL:
Execute the following sequence of commands and kill them all!
Then execute: RM-RF/ETC/MY.CNF
Delete the MySQL config file if it still exists!
2. Download MySQL source code to start compiling the installation
First, you need to install some dependent packages:
Yum-y Install CMake gcc-c++ ncurses-devel
CMake is used to compile MySQL tools, this first install, and then install the process, if the error continues to install other dependent packages!
Start compiling the installation as follows:
For a description of the relevant configuration item, see: Http://dev.mysql.com/doc/refman/5.6/en/source-configuration-options.html
If the error, after troubleshooting, remember to delete the cache file, and then recompile, as follows:
RM-RF CMakeCache.txt
Until it appears as follows:
Indicates a successful compilation, although a warning was reported, but the problem is not big, continue: Make && make install
Wait..........
Then copy the configuration file into the/etc directory:
Because running MySQL is best not to run as root, you need to set up users and user groups first:
Groupadd MySQL
Useradd-r-G MySQL MySQL
If it exists, delete it first:
Userdel MySQL
Groupdel MySQL
After creating the user and user groups, modify the/usr/local/mysql permissions:
Chown-r root:mysql/usr/local/mysql---Set the MySQL owner to root, the owning group is set to MySQL
Chown-r Mysql:mysql/usr/local/mysql/data---Set the owning combination owner setting of the data file to MySQL
Then, create the database for the MySQL system:
Execution success, prompt message:
Now look at the MySQL process information, execute: Ps-el | grep MySQL (empty)
Then start MySQL and follow the prompts to execute: Usr/local/mysql/bin/mysqld_safe &
Continue viewing the MySQL process information after successful startup, as follows:
Then stop the MySQL process and configure the boot through service:
Kill 32758
Then copy the Mysql.server file to the/etc/init.d/directory and execute:
Cp/usr/local/mysql/support-files/mysql.server/etc/init.d/mysql
Then execute:/etc/init.d/mysql start to launch MySQL, as follows:
Then stop MySQL, execute:/etc/init.d/mysql stop
Then do: chkconfig MySQL on add MySQL to random boot, then execute: Service MySQL start to start mysql!
Finally, the MySQL bin directory is added to the environment variable, so that it is easy to execute MySQL directly under the shell, and then you can connect to the MySQL server, but before the connection needs to first change the password MySQL!
Execute the following command:
Vim/etc/profile
Add the following code:
Export path= "/usr/local/mysql/bin/": $PATH
Save after exit execution: source /etc/profile
Then modify the password of the root user in MySQL according to the prompt, execute:
mysqladmin-u root password ' ****** '
Then execute: mysql-u root-p
To connect to MySQL, enter the password you just set!
Finally, if you want to allow MySQL to connect remotely, you need a firewall to open port 3306 to do the following settings:
Vim/etc/sysconfig/iptables
Add the following code:
Then restart the firewall for the configuration to take effect, execute: Service iptables restart
At this point, the entire MySQL compilation installation is over!
centos6.4 Compiling and installing MySQL