centos6.4 Compiling and installing MySQL

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.