CentOS 6.4 Under compile install MySQL 5.6.16

Source: Internet
Author: User

First, uninstall the old version of MySQL

1 , rpm Uninstall:

1> Check the installation package:

Rpm-qa | grep MySQL

2> Normal Delete:

Rpm-e mysql-5.6.16.rpm

3> Brute Force Delete. If you are prompted to have other dependent files when you delete with the above command, you can use this command to remove them forcefully.

RPM-E--nodeps mysql-5.6.16.rpm

2. Tar unload:

1> Delete temporary files:

Make clean

2> Uninstall

Make Uninstall

3> Deleting extracted files

Rm-rf folder

3. Yum Uninstall:

1> Uninstalling a software:

Yum Remove Package_name

2> Uninstalling multiple:

Yum Remove package_name1 package_name2 package_name3


Second, install MySQL

1. Install compiler gcc-c++:

Yum-y install make gcc-c++ cmake bison-devel ncurses-devel

2. Download and unzip:

1> Download the TAR installation package:

wget http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.16.tar.gz

2> Unpacking the installation package:

TAR-XZVF mysql-5.6.16.tar.gz

3> to rename the extracted files:

MV mysql-5.6.16 MySQL

3. Compile and install:

1. Enter the installation directory:

CD MySQL

2. Configuration parameters:

CMake \

-dcmake_install_prefix=/usr/local/mysql \

-dmysql_datadir=/home/mysql/data \

-dsysconfdir=/etc

-dwith_myisam_storage_engine=1 \

-dwith_innobase_storage_engine=1 \

-dwith_memory_storage_engine=1 \

-dwith_readline=1 \

-dmysql_unix_addr=/var/lib/mysql/mysql.sock \

-dmysql_tcp_port=3306 \

-denabled_local_infile=1 \

-dwith_partition_storage_engine=1 \

-dextra_charsets=all \

-ddefault_charset=utf8 \

-ddefault_collation=utf8_general_ci


3> Compile and install:

Make && make install

The compiled parameters can refer to http://dev.mysql.com/doc/refman/5.5/en/source-configuration-options.html.

The whole process takes about 30 minutes ... A long wait


Third, configure MySQL:

1. Set Permissions:

1> use the following command to see if there are MySQL users and user groups:

CAT/ETC/PASSWD View the list of users

Cat/etc/group viewing a list of user groups

2> if not, create:

Groupadd MySQL

useradd-g MySQL MySQL

3> Modify/usr/local/mysql Permissions:

Chown-r Mysql:mysql/usr/local/mysql

2. Initialize the configuration:

1> Entering the installation path

Cd/usr/local/mysql

2, enter the installation path, execute the initialization configuration script, create the system's own database and table:

scripts/mysql_install_db  --basedir=/usr/local/mysql --datadir=/Home/mysql/data --user=mysql

Note: When starting the MySQL service, will be in a certain order to search my.cnf, first in the/etc directory, find will search "$basedir/my.cnf", in this case is/usr/local/mysql/ MY.CNF, this is the default location for the new MySQL configuration file! Note: After the minimum installation of the CentOS version 6.4 operating system, there will be a my.cnf in the/etc directory, which will need to be renamed to a different name, such as:/etc/ My.cnf.bak, otherwise, the file will interfere with the correct configuration of the source installed MySQL, resulting in the inability to start.

3. Start MySQL:

1> Add service, Copy Service script to INIT.D directory, and set boot up and take effect (can not set)

CP Support-files/mysql.server /etc/init.d/mysql

Chkconfig MySQL on

2> start MySQL:

Service MySQL Start--start MySQL

4. Configure users

After MySQL starts successfully, Root does not have a password, we need to set the root password.

Before setting, we need to set path, or we can't call MySQL directly

1> Modify the/etc/profile file and add it at the end of the file

Path=/usr/local/mysql/bin: $PATH

Export PATH

2> make the environment variable configuration file effective immediately:

Source/etc/profile

3> enter MySQL in the terminal directly into the MySQL environment, execute the following command to modify the root password:

Mysql-uroot

mysql> SET PASSWORD = PASSWORD (' 123456 ');

4> to set the root user to remotely access, execute

Mysql> GRANT All privileges on * * to ' root ' @ ' 172.16.% ' identified by 'password' with GRANT OPTION;

When the red password is remote access, the root user's password can be different from the local.

5, configure the firewall: (If you do not use a firewall, this step can not be used)

1> Firewall 3306 port is not enabled by default, to remote access, you need to open this port

Open/etc/sysconfig/iptables

Under "-A input–m State--state new–m tcp–p–dport 22–j ACCEPT", add:

-A INPUT m state--state NEW m TCP p dport 3306 J ACCEPT

2> then save and close the file, run the following command in the terminal and refresh the firewall configuration:

Service Iptables Restart


Ok!

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.