CentOS-6.3 installation mysql-5.5.29[Turn]

Source: Internet
Author: User

Installation method is divided into rpm and source code compiled installation Two, this article is the use of MySQL source code compilation, the compiler uses CMake. The software requires mysql-5.5.29.tar.gz and cmake-2.8.10.2.tar.gz, please download it yourself.

http://mysql.mirror.kangaroot.net/Downloads/
Http://www.cmake.org/files/v2.8/cmake-2.8.10.2.tar.gz
MySQL uses the latest stable version, that is, the latest trial version of the previous version, and non-RC or alpha version, CMake Direct use of the latest version.

1. Upload mysql-5.5.29.tar.gz and cmake-2.8.10.2.tar.gz to the/usr/local folder. 2.CentOS mounting g++ and Ncurses-devel

[[email protected] local] #yum install gcc-c++
[[email protected] local] #yum install Ncurses-devel

Installation of 3.cmake

[[email protected]] #tar-zxv-f cmake-2.8.10.2.tar.gz//Unzip the package
[[email protected] local] #cd cmake-2.8.10.2
[Email protected] Cmake-2.8.10.2]#./configure
[[email protected] cmake-2.8.10.2] #make
[[email protected] cmake-2.8.10.2] #make Install

4. Permanently add cmake to the system environment variable

Add the variable in the file/etc/profile file with VI to make it permanent and effective,
[[email protected] local] #vi/etc/profile

Append the following two lines of code to the end of the file:
Path=/usr/local/cmake-2.8.10.2/bin: $PATH
Export PATH

Execute the following code to make the changes take effect:
[[email protected] local] #source/etc/profile

To view the path value with the Export command
[[email protected] local] #echo $PATH

5. Create a MySQL installation directory and database storage directory

[[email protected]] #mkdir-p/usr/local/mysql//install MySQL
[[email protected]] #mkdir-p/usr/local/mysql/data//Storage Database

6. Create MySQL users and user groups

[Email Protected]]groupadd MySQL
[[Email Protected]]useradd-r-G MySQL MySQL

7. Compile and install MySQL

[[email protected] local] #tar-zxv-f mysql-5.5.29.tar.gz//Decompression
[[email protected] local] #cd mysql-5.5.29
[Email protected] mysql-5.5.29]#
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
[[email protected] mysql-5.5.29] #make
[[email protected] mysql-5.5.29] #make Install

8. Verify the installation is successful

[[email protected] mysql-5.5.29] #cd/usr/local/mysql/
[[email protected] MySQL] #ls
Bin COPYING data docs include Install-binary lib man mysql-test README scripts share Sql-bench support-files
Have bin and other documents, congratulations you have successfully installed MySQL.

Configure MYSQL9. Set MySQL directory permissions

[[email protected] mysql]# cd/usr/local/mysql//the owner of all files in the current directory to root, the group is MySQL
[Email protected] mysql]# chown-r root:mysql.
[Email protected] mysql]# chown-r mysql:mysql data

10. Add the MySQL startup service to the system service

[email protected] mysql]# CP support-files/my-medium.cnf/etc/my.cnf
CP: Do you want to overwrite "/etc/my.cnf"? Y

11. Create a table for the system database

[Email protected] mysql]# Cd/usr/local/mysql
[Email protected] mysql]# scripts/mysql_install_db--user=mysql

12. Setting Environment variables

[[Email protected] ~] #vi/root/.bash_profile
In modifying the path= $PATH: $HOME/bin is:
Path= $PATH: $HOME/bin:/usr/local/mysql/bin:/usr/local/mysql/lib
[[email protected] ~]# source/root/.bash_profile//make the changes take effect

13. Manually start MySQL

[Email protected] ~]# Cd/usr/local/mysql
[[email protected] mysql]#./bin/mysqld_safe--user=mysql &//start MySQL, but cannot stop
Mysqladmin-u Root-p shutdown//At this time root has no password, so the null value, prompt for the password, enter directly.

14. Add the MySQL startup service to the system service

[email protected] mysql]# CP Support-files/mysql.server/etc/init.d/mysql

15. Start MySQL

[[Email protected] mysql]# service MySQL start
Starting MySQL ... error! The server quit without updating PID file (/usr/local/mysql/data/localhost.localdomain.pid).

Startup failure:
I'm here for permission issues, change permissions first
[Email protected] mysql]# chown-r mysql:mysql/usr/local/mysql

Then start the server
[[email protected] mysql]#/etc/init.d/mysql start

16. Modify the password of the root user of MySQL and open the remote connection

[[email protected] mysql]# mysql-u root MySQL

mysql> use MySQL;
mysql> desc User;
Mysql> GRANT All privileges on * * to [e-mail protected] "%" identified by "root";//ability to add remote connections to root
mysql> Update user Set Password = Password (' 123456 ') where user= ' root ';//set root user password
Mysql> Select Host,user,password from User where user= ' root ';
mysql> flush Privileges;
Mysql> exit

17. Re-Login

[Email protected] mysql]# mysql-u root-p
Enter password:123456

If you are not able to connect remotely, turn off the firewall
[[Email protected]]#/etc/rc.d/init.d/iptables Stop

CentOS-6.3 installation mysql-5.5.29[Turn]

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.