Centos6.5 source code compilation and installation of mysql5.6.17

Source: Internet
Author: User
License cdcmake-2.8.12.2.configure -- prefixusrlocalcmake

Install yum-y install gcc-c yum-y install ncurses-devel to download bison-3.0 tar zxvf bison.tar.gz. /configure make install download cmake-2.8.12.2.tar.gz tar zxvf cmake-2.8.12.2.tar.gz cd cmake-2.8.12.2. /configure -- prefix =/usr/local/cmake

Install
Yum-y install gcc-c ++
Yum-y install ncurses-devel

Download "bison-3.0"
Tar zxvf bison.tar.gz
./Configure
Make & make install

Download cmake-2.8.12.2.tar.gz
Tar zxvf cmake-2.8.12.2.tar.gz
Cd cmake-2.8.12.2
./Configure -- prefix =/usr/local/cmake or./bootstrap
Make & make install

Install mysql

Download mysql-5.6.17.tar.gz

Tar zxvf mysql-5.6.17.tar.gz

Cd mysql-5.6.17

Cmake \
-DCMAKE_INSTALl_PREFIX =/usr/local/mysql \
-DMYSQL_DATADIR =/usr/local/mysql/data \
-DSYSCONFDIR =/usr/local/mysql/etc \
-DWITH_MYISAM_STORAGE_ENGINE = 1 \
-DWITH_INNOBASE_STORAGE_ENGINE = 1 \
-DWITH_MEMORY_STORAGE_ENGINE = 1 \
-DWITH_READLINE = 1 \
-DMYSQL_UNIX_ADDR =/tmp/mysql. sock \
-DMYSQL_TCP_PORT = 3306 \
-DENABLED_LOCAL_INFILE = 1 \
-DEXTRA_CHARSETS = all \
-DDEFAULT_CHARSET = utf8 \
-DDEFAULT_COLLATION = utf8_general_ci


Make & make install
======================================
Note 1: problems may occur during step 1 installation, for example, CMake Error: The source directory "*" does not appear to contain CMakeLists.txt. specify-help for usage, or press the help button on the CMake GUI.

Is the installation version error, for example, in the http://dev.mysql.com/downloads/mysql/ download page, we want to select the Source Code under MySQL Community Server,

Then select the "Generic Linux mysql-5.6.17.tar.gz" version of the source code download in the displayed list.

======================================
Iii. MySQL Configuration
1. Link to the client library file (if this step is not executed, the MySQL file cannot be found during PHP compilation)
Ln-s/usr/local/mysql/lib/libmysqlclient. so.18/usr/lib64/libmysqlclient. so.18

Run the following command to check whether mysql users and user groups exist:

Cat/etc/passwd view User List
Cat/etc/group view User group list
Groupadd mysql # Add a mysql Group
Useradd-g mysql

Chown-R mysql: mysql/usr/local/mysql

Go to the mysql installation directory/usr/local/mysql:
Execute the initialization configuration script to create the database and table that comes with the system.
Scripts/mysql_install_db -- basedir =/usr/local/mysql -- datadir =/usr/local/mysql/data -- user = mysql

Vi/usr/local/mysql/my. cnf // Add the following content
Basedir =/usr/local/mysql
Datadir =/usr/local/mysql/data
Add a service, copy the service script to the init. d directory, and set startup
Cp/usr/local/mysql/support-files/mysql. server/etc/init. d/mysqld # Add mysqld to system startup

/Etc/init. d/mysqld start
Chkconfig -- add mysqld // add a service
Chkconfig mysqld on // set startup
Ln-s/usr/local/mysql/bin/mysql/usr/bin/mysql for convenient calling, set a soft link for mysql

Mysql-uroot-p # connect to the database, no password by default

/Usr/local/mysql/bin/mysqladmin-u root password root # Set the password root

Modify the/etc/profile file and add
Export PATH =/usr/local/mysql/bin: $ PATH
Close the file and run the following command to make the configuration take effect immediately
Source/etc/profile
========================================================== ========================================================== =====
The following line links the myslq library file to the default location of the system, so that you do not need to specify the mysql library file address when compiling software such as PHP.
Ln-s/usr/local/mysql/include/mysql/usr/include/mysql

Deletes an empty password account for an anonymous connection to the local machine.
Log on to mysql
Mysql> use mysql; // select the default database mysql
Mysql> update user set password = password ('root') where user = 'root'; modify the root password
Mysql> delete from user where password = ""; // the root password cannot be blank.
Mysql> flush privileges;
Mysql> quit

Configure Firewall
Port 3306 of the firewall is disabled by default. To access the firewall remotely, you must enable this port.
Open/etc/sysconfig/iptables
In "-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
Save and close the file. Run the following command in the terminal to refresh the Firewall Configuration:
Service iptables restart

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.