Installing MySQL 5.7.10 under Centos 6.3 using source code

Source: Internet
Author: User

Recently wanted to try the new version of MySQL 5.7.10, and then began to try to play the next.

In this installation, use source code compilation to install MySQL, the compiler uses CMake.
The version chosen here is the version of Mysql-5.7.10,cmake is cmake-2.8.10.2
Note: When downloading the source package, please be careful to select platform as "source code".
Environment:
[email protected] mysql]$ sudo cat/etc/redhat-release
CentOS Release 6.3 (Final)
[Email protected] mysql]$ uname-a
Linux e3ddba11 2.6.32-279.el6.x86_64 #1 SMP Fri June 12:19:21 UTC + x86_64 x86_64 x86_64 gnu/linux
Here are the installation steps:
1. Upload the mysql-5.7.10.tar.gz and cmake-2.8.10.2.tar.gz files to the E3ddba11/usr/local folder.

2. Install g++ and ncurses_devel on CentOS
[email protected] local]$ sudo yum install gcc-c++
[email protected] local]$ sudo yum install Ncurses-devel

3. Install make
[[email protected] local]$ sudo yum install make
Otherwise the error will be: Cannot find appropriate Makefile processor on the This system.

4. Installing CMake
[email protected] local]$ sudo tar-zxvf cmake-2.8.10.2.tar.gz
[Email protected] local]$ CD cmake-2.8.10.2
[[email protected] cmake-2.8.10.2]$ sudo./configure
[[email protected] cmake-2.8.10.2]$ sudo make
[[email protected] cmake-2.8.10.2]$ sudo make install

5. Install boost for use when MySQL is installed later.
Select boost_1_59_0.tar.gz Download in http://sourceforge.net/projects/boost/files/boost/1.59.0/and upload to E3ddba11/usr/local
[email protected] local]$ sudo tar-zxvf boost_1_59_0.tar.gz

6. Add CMake to the system environment variable
[email protected] cmake-2.8.10.2]$ sudo vi/etc/profile
Add two lines at the end;
Path=/usr/local/cmake-2.8.10.2/bin: $PATH
Export PATH
Then execute the following code to make the modification take effect. ----here can not directly execute sudo source/etc/profile will error Sudo:source:command not found
[Email protected] cmake-2.8.10.2]$ Source/etc/profile
[Email protected] cmake-2.8.10.2]$ sudo-s
[Email protected] cmake-2.8.10.2]# Source/etc/profile
At this point, we can use export to view the current path value
[Email protected] cmake-2.8.10.2]$ echo $PATH

6. Create the MySQL installation directory and the path to the database file storage
[email protected] cmake-2.8.10.2]$ sudo mkdir-p/usr/local/mysql
[email protected] cmake-2.8.10.2]$ sudo mkdir-p/usr/local/mysql/data/

7. Create MySQL users and corresponding user groups
[[email protected] cmake-2.8.10.2]$ sudo groupadd mysql
[[email protected] cmake-2.8.10.2]$ sudo useradd-r-g MySQL MySQL

8. Compile and install MySQL
[[[email protected] cmake-2.8.10.2]$ cd/usr/local/
[[email protected] local]$ sudo TAR-ZXVF mysql-5.5.37.tar.gz
[[email protected] local]$ cd mysql-5.5.37
[[email protected] mysql-5.5.37]$
sudo cmake-dcmake_install_prefix=/usr/local/mysql \
-dmysql_unix_addr=/usr/local/mysql/ Mysql.sock \
-ddefault_charset=utf8 \
-ddefault_collation=utf8_general_ci \
-dwith_myisam_storage_engine =1 \
-dwith_innobase_storage_engine=1 \
-dwith_memory_storage_engine=1 \
-dwith_readline=1 \
-DENABLED _local_infile=1 \
-dmysql_datadir=/usr/local/mysql/data \
-dmysql_user=mysql \
-dmysql_tcp_port=3306 \
-dwith_boost=/usr/local/boost_1_59_0
[[email protected] mysql-5.5.37]$ sudo make
[[email  Protected] mysql-5.5.37]$ sudo make install

9. Verify that MySQL is installed successfully
[Email protected] mysql-5.5.37]$ Cd/usr/local/mysql
[[email protected] mysql]$ ls
Bin COPYING data docs include Install-binary lib man mysql.sock mysql-test README scripts share Sql-bench support-files
If you see any of these files or folders, then it proves that MySQL installation is successful.

10. Set permissions for the MySQL directory
[email protected] mysql]$ sudo chown-r mysql:mysql/usr/local/mysql
[email protected] mysql]$ sudo chown-r mysql:mysql data
11. Create a table for the system database
[Email protected] mysql]$ Cd/usr/local/mysql/bin
[email protected] mysql]$ sudo./mysqld--initialize--user=mysql
12.MY.CNF configuration file generation
[email protected] bin]$ sudo cp. /support-files/my-default.cnf/etc.my.cnf
13. Set the MySQL service to turn on automatically
[email protected] bin]$ sudo cp. /support-files/mysql.server/etc/init.d/mysqld
[[email protected] bin]$ sudo chkconfig--add mysqld && chkconfig mysqld on
14. Setting Environment variables
[email protected] mysql]$ sudo vi/root/.bash_profile
Modify path to:
Path= $PATH: $HOME/bin:/usr/local/mysql/bin:/usr/local/mysql/lib
Then execute the following code to make the modification take effect. ----here can not directly execute sudo source/etc/profile will error Sudo:source:command not found
[Email protected] mysql]$ Source/root/.bash_profile
[Email protected] mysql]$ sudo-s
[Email protected] mysql]# Source/root/.bash_profile
The MySQL path is also added to the/etc/profile.
[email protected] mysql]$ sudo vi/etc/profile
Add two lines at the end
Path=/usr/local/mysql/bin: $PATH
Export PATH
[Email protected] mysql]$ Source/etc/profile
[Email protected] mysql]$ sudo-s
[Email protected] mysql]# Source/etc/profile
15. Turn on MySQL service
[email protected] bin]$ sudo./mysqld_safa--user=mysql--skip-grant-tables &
16. Open a new session in another window and enter MySQL. Change the root password.
[Email protected] bin]$ Mysql-uroot
mysql> Update Mysql.user Set Authentication_string=password (' Wison ') where user= ' root ' and host= ' localhost '
;
Query OK, 1 row affected, 1 warning (0.01 sec)
Rows matched:1 changed:1 warnings:1

mysql> flush Privileges;
Query OK, 0 rows Affected (0.00 sec)
16. Go to MySQL:
[Email protected] ~]$ Mysql-uroot-pwison
MySQL: [Warning] Using a password on the command line interface can is insecure.
Welcome to the MySQL Monitor. Commands End With; or \g.
Your MySQL Connection ID is 2
Server version:5.7.10

Copyright (c), Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of the Oracle Corporation and/or its
Affiliates. Other names trademarks of their respective
Owners.

Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.

mysql> show databases;
ERROR 1820 (HY000): Must reset your password using ALTER USER statement before executing this statement.
mysql> alter user ' root ' @ ' localhost ' identified by ' Wison ';
Query OK, 0 rows Affected (0.00 sec)

Here, MySQL is already installed.

Installing MySQL 5.7.10 under Centos 6.3 using source code

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.