MySQL 5.6 Installation

Source: Internet
Author: User

Installation Environment:
centos:6.8
mysql:5.6
First, clear the host's own MySQL,
Install the tools and libraries needed to compile the source code
Yum install gcc gcc-c++ ncurses-devel perl

Install CMake, download the source code from www.cmake.org and compile the installation
TAR-XZVF cmake-2.8.10.2.tar.gz
CD cmake-2.8.10.2
./bootstrap
Make && make install

Download MySQL source package and start compiling
TAR-ZXF mysql-5.6.23.tar.gz
CD mysql-5.6.23
?
?
?
Some preparatory work
Set up MySQL users and groups
New MySQL user group
Groupadd MySQL

New MySQL User
Useradd-r-G MySQL MySQL

The directory required to create a new MySQL
New MySQL installation directory
Mkdir-p/usr/local/mysql
?
New MySQL database data file directory
Mkdir-p/data/mysqldb
?
?
?
Compiling the installation
The CMake execution script is:
CMake
-dcmake_install_prefix=/usr/local/mysql-dmysql_unix_addr=/usr/local/mysql/mysql.sock
-ddefault_charset=utf8
-ddefault_collation=utf8_general_ci
-dwith_innobase_storage_engine=1
-dwith_archive_storage_engine=1
-dwith_blackhole_storage_engine=1
-dmysql_datadir=/data/mysqldb
-dmysql_tcp_port=3306
-denable_downloads=1

Description
Some of the CMake commands in the online articles are as follows:
Cmake--dcmake_install_prefix=/usr/local/mysql
-dmysql_unix_addr=/data/mysql/mysql.sock
-ddefault_charset=utf8
-ddefault_collation=utf8_general_ci
-dwith_extra_charsets:string=utf8,gbk
-dwith_myisam_storage_engine=1
-dwith_innobase_storage_engine=1
-dwith_memory_storage_engine=1
-dwith_readline=1
-denabled_local_infile=1
-dmysql_datadir=/data/mysql
-dmysql_user=mysql
-dmysql_tcp_port=3306

Post-compilation warnings are displayed:

That is, Mysql_user and other modules are not available.
At this point, if you need to reconfigure, delete the CMakeCache.txt file:
RM CMakeCache.txt
?
Remove the Mysql_user and other unavailable options, then recompile.
10.
Cmake--dcmake_install_prefix=/usr/local/mysql-dmysql_unix_addr=/data/mysql/mysql.sock
-ddefault_charset=utf8
-ddefault_collation=utf8_general_ci
-dwith_extra_charsets:string=utf8,gbk
-dwith_myisam_storage_engine=1
-dwith_innobase_storage_engine=1
-denabled_local_infile=1
-dmysql_datadir=/data/mysql
-dmysql_tcp_port=3306

Compile & Install
Make &&make Install
These two steps will take a long time, please wait patiently.

Modify MySQL directory Owners and Groups
Modifying the MySQL installation directory
Cd/usr/local/mysql
Chown-r Mysql:mysql.
?
Modifying the MySQL database file directory
Cd/data/mysqldb
Chown-r Mysql:mysql.
?
Description
Chown last followed by the file name. Use "." Here to indicate the current directory.

Start MySQL
Initializing MySQL Database
Cd/usr/local/mysql
scripts/mysql_install_db--user=mysql--datadir=/data/mysqldb

Description
As you can see from the print log, the purpose of the mysql_install_db command is to generate a MySQL system table. And finally generate a my.cnf file in the MySQL directory.
The--user=mysql function is to specify the user name that runs the mysqld process. After setting up this user, all files created through the mysqld process (such as logs, etc.) will belong to this user.

MySQL configuration file
Cp/usr/local/mysql/support-files/my-default.cnf/etc/my.cnf
Note: Overwrite if the/etc/my.cnf file exists.
There are multiple access locations for MySQL configuration files. MySQL accesses this, and the configuration after access overrides the previous configuration.
The access path and access order of the MySQL access configuration file are as follows:

?
Configure MySQL
[Client]
#password = Your_password
Port = 3306
Socket =/data/mysql/mysql.sock
Default-character-set=utf8
. Note Here follows entries for some pecific programs
Note: the MySQL server

[Mysqld]
Port = 3306
Character_set_server=utf8
Basedir=/data/mysql
Datadir=/data/mysql/data
Socket =/data/mysql/mysql.sock
Skip-external-locking
Key_buffer_size = 16M
Max_allowed_packet = 1M
Table_open_cache = 64
Sort_buffer_size = 512K
Net_buffer_length = 8K
Read_buffer_size = 256K
Read_rnd_buffer_size = 512K
Myisam_sort_buffer_size = 8M

Add mysql execution command to path
Vim/etc/profile
?
Add content at the end of the file:
Path= $PATH:/usr/local/mysql/bin
Export PATH?
After leaving, execute:
Source/etc/profile

Set MySQL as a system service and start the service
CP Support-files/mysql.server/etc/init.d/mysqld
?
That is, MySQL can start in the following form:
Service mysqld Start
?
If the error "starting MySQL." error! The server quit without updating PID file (/data/mysql/rhelubuntu.com.pid). "? then Modify
Vim/etc/init.d/mysqld
Modify Basedir=/usr/local/mysql???????????? -----MySQL Installation location
Modify Datadir=/var/data/mysqldata????????? -----where MySQL data files are stored
? Generally modify this and restart MySQL should not be an error.
?
Check to see if MySQL has started:
NETSTAT-TULNP | grep 3306
?
?
Configure users
Using a MySQL client to connect to a MySQL server
Mysql-u root-p
The initial password is empty and if it can be logged on, the installation is successful.
?
Set the MySQL administrator password
mysqladmin-u root password "123456";
Then 123456 is the new password.
?
Setting up MySQL Telnet
Grant all on . to [email protected] '% ';
Flush privileges;

MySQL 5.6 Installation

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.