Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install and configure Mysql-5.5.29 in CentOS 6.3

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article focuses on "how to install and configure Mysql-5.5.29 in CentOS 6.3". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn "how to install and configure Mysql-5.5.29 in CentOS 6.3"!

First, install mysql

Installation methods are divided into: rpm and source code compilation and installation, this paper uses mysql source code compilation mode, 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.

Download address:

Http://mysql.mirror.kangaroot.net/Downloads/

Http://www.cmake.org/files/v2.8/cmake-2.8.10.2.tar.gz

Among them, mysql uses the latest stable version, that is, the previous version of the latest trial version, which is not the rc or alpha version, and the latest version directly used by Cmake.

1. Upload mysql-5.5.29.tar.gz and cmake-2.8.10.2.tar.gz to the / usr/local folder.

2.CentOS installs Gmail + and ncurses-devel

The code is as follows:

[root@zck local] # yum install gcc-c++

[root@zck local] # yum install ncurses-devel

Installation of 3.cmake

The code is as follows:

[root@zck] # tar-zxv-f cmake-2.8.10.2.tar.gz / / decompress the package

[root@zck local] # cd cmake-2.8.10.2

[root@zck cmake-2.8.10.2] #. / configure

[root@zck cmake-2.8.10.2] # make

[root@zck cmake-2.8.10.2] # make install

4. Permanently add cmake to the system environment variable

Add variables to the file / etc/profile file with vi to make it permanent

[root@zck local] # vi / etc/profile

Append the following two lines of code to the end of the file:

The code is as follows:

PATH=/usr/local/cmake-2.8.10.2/bin:$PATH

Export PATH

Execute the following code to make the changes take effect:

[root@zck local] # source / etc/profile

Use the export command to view the path value

[root@zck local] # echo $PATH

5. Create the installation directory and database storage directory for mysql

The code is as follows:

[root@zck] # mkdir-p / usr/local/mysql / / install mysql

[root@zck] # mkdir-p / usr/local/mysql/data / / stores the database

6. Create mysql users and user groups

The code is as follows:

[root@zck] groupadd mysql

[root@zck] useradd-r-g mysql mysql

7. Compile and install mysql

The code is as follows:

[root@zck local] # tar-zxv-f mysql-5.5.29.tar.gz / / decompress

[root@zck local] # cd mysql-5.5.29

[root@zck 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

[root@zck mysql-5.5.29] # make

[root@zck mysql-5.5.29] # make install

8. Verify that the installation is successful

The code is as follows:

[root@zck mysql-5.5.29] # cd / usr/local/mysql/

[root@zck mysql] # ls

Bin COPYING data docs include INSTALL-BINARY lib man mysql-test README scripts share sql-bench support-files

If you have the above files such as bin, it means that mysql is installed successfully.

2. Configure mysql

9. Set mysql directory permissions

The code is as follows:

[root@zck mysql] # cd / usr/local/mysql / / set the owner of all files in the current directory to root and the group to which they belong is mysql

[root@zck mysql] # chown-R root:mysql.

[root@zck mysql] # chown-R mysql:mysql data

10. Add mysql startup service to the system service

The code is as follows:

[root@zck mysql] # cp support-files/my-medium.cnf / etc/my.cnf

Cp: overwrite "/ etc/my.cnf"? Y

11. Create a table for the system database

The code is as follows:

[root@zck mysql] # cd / usr/local/mysql

[root@zck mysql] # scripts/mysql_install_db-- user=mysql

twelve。 Set environment variabl

The code is as follows:

[root@zck ~] # vi / root/.bash_profile

After modifying the PATH=$PATH:$HOME/bin to:

PATH=$PATH:$HOME/bin:/usr/local/mysql/bin:/usr/local/mysql/lib

[root@zck ~] # source / root/.bash_profile / / to make the changes just made effective

13. Start mysql manually

The code is as follows:

[root@zck ~] # cd / usr/local/mysql

[root@zck mysql] #. / bin/mysqld_safe-- user=mysql & / / start MySQL, but cannot stop

Mysqladmin-u root-p shutdown / / root does not have a password at this time, so it is null. When prompted for a password, enter directly.

14. Add mysql startup service to the system service

The code is as follows:

[root@zck mysql] # cp support-files/mysql.server / etc/init.d/mysql

15. Start mysql

The code is as follows:

[root@zck mysql] # service mysql start

Starting MySQL... ERROR! The server quit without updating PID file (/ usr/local/mysql/data/localhost.localdomain.pid).

Failed to start:

I have a question of permissions here. Change the permissions first.

[root@zck mysql] # chown-R mysql:mysql / usr/local/mysql

Then start the server

[root@zck mysql] # / etc/init.d/mysql start

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

The code is as follows:

[root@zck mysql] # mysql-u root mysql

Mysql > use mysql

Mysql > desc user

Mysql > GRANT ALL PRIVILEGES ON *. * TO root@ "%" IDENTIFIED BY "root"; / / ability to add remote connections to root

Mysql > update user set Password = password ('123456') where User='root'; / / set the root user password

Mysql > select Host,User,Password from user where User='root'

Mysql > flush privileges

Mysql > exit

17. Log in again

The code is as follows:

[root@zck mysql] # mysql-u root-p

Enter password:123456

If you cannot connect remotely, turn off the firewall

The code is as follows:

[root@zck] # / etc/rc.d/init.d/iptables stop

At this point, I believe you have a deeper understanding of "how to install and configure Mysql-5.5.29 in CentOS 6.3". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report