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

Detailed steps of compiling and installing MySQL5.6.14 under CentOS6.4

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article introduces the relevant knowledge of "detailed steps to compile and install MySQL 5.6.14 under CentOS 6.4". In the actual case operation process, many people will encounter such difficulties. Next, let Xiaobian lead you to learn how to deal with these situations! I hope you can read carefully and learn something!

1: Uninstalling older versions

Check if MySQL Server is installed using the following command

The code is as follows:

rpm -qa | grep mysql

If so, uninstall it by following the command

The code is as follows:

rpm -e mysql //normal delete mode

rpm -e --nodeps mysql //strong delete mode, if you use the above command to delete, prompt that there are dependent other files, then use this command to forcibly delete them.

install MySQL

Install packages needed to compile code

The code is as follows:

yum -y install make gcc-c++ cmake bison-devel ncurses-devel

Download MySQL 5.6.14

The code is as follows:

wget http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.14.tar.gz

tar xvf mysql-5.6.14.tar.gz

cd mysql-5.6.14

compile and install

The code is as follows:

cmake \

-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \

-DMYSQL_DATADIR=/usr/local/mysql/data \

-DSYSCONFDIR=/etc \

-DWITH_MYISAM_STORAGE_ENGINE=1 \

-DWITH_INNOBASE_STORAGE_ENGINE=1 \

-DWITH_MEMORY_STORAGE_ENGINE=1 \

-DWITH_READLINE=1 \

-DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock \

-DMYSQL_TCP_PORT=3306 \

-DENABLED_LOCAL_INFILE=1 \

-DWITH_PARTITION_STORAGE_ENGINE=1 \

-DEXTRA_CHARSETS=all \

-DDEFAULT_CHARSET=utf8 \

-DDEFAULT_COLLATION=utf8_general_ci

make && make install

The compiled parameters can be found at http://dev. mysql. com/doc/refman/5.5/en/source-configuration-options.html.

The whole process takes about 30 minutes…a long wait

3: Configure MySQL

set permissions

Use the following command to see if there are mysql users and user groups

The code is as follows:

cat /etc/passwd View user list

cat /etc/group View user group list

If not, create it.

The code is as follows:

groupadd mysql

useradd -g mysql mysql

modify/usr/local/mysql permissions

The code is as follows:

chown -R mysql:mysql /usr/local/mysql

modify/usr/local/mysql permissions

initialization configuration

Enter installation path

The code is as follows:

cd /usr/local/mysql

Enter the installation path, execute the initialization configuration script, and create the database and tables that come with the system.

The code is as follows:

scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql

Note: When starting MySQL service, my.cnf will be searched in a certain order, first in/etc directory, if not found, it will search for "$basedir/my.cnf", in this case,/usr/local/mysql/my.cnf, which is the default location of the new MySQL configuration file! Note: After the minimum installation of CentOS version 6.4 operating system is completed, there will be a my.cnf file in the/etc directory. You need to rename this file to another name, such as/etc/my.cnf.bak, otherwise, this file will interfere with the correct configuration of MySQL installed by the source code, resulting in failure to start.

start the MySQL

Add service, copy service script to init.d directory, and set boot

The code is as follows:

cp support-files/mysql.server /etc/init.d/mysql

chkconfig mysql on

service mysql start --Start MySQL

configure user

After MySQL starts successfully, root has no password by default. We need to set root password.

Before setting, we need to set PATH first, otherwise we can't call mysql directly.

Modify the/etc/profile file by adding

The code is as follows:

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

export PATH

Close the file and run the following command to make the configuration take effect immediately

The code is as follows:

source /etc/profile

Now, we can enter mysql directly into the terminal, mysql environment.

Change the root password by executing the following command

The code is as follows:

mysql -uroot

mysql> SET PASSWORD = PASSWORD('123456');

To set remote access for root, execute

The code is as follows:

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'172.16.% ' IDENTIFIED BY 'password' WITH GRANT OPTION;

The password in red is the root password for remote access, which can be different from the local password.

configure the firewall

Firewall port 3306 is not open by default. To access remotely, you need to open this port.

Open/etc/sysconfig/iptables

Under "-A INPUT-m state --state NEW-m tcp-p-dport 22-j ACCEPT," add:

The code is as follows:

-A INPUT m state --state NEW m tcp p dport 3306 j ACCEPT

Then save and close the file, and run the following command in the terminal to refresh the firewall configuration:

The code is as follows:

service iptables restart

OK, everything is configured, you can access your MySQL.

"CentOS 6.4 under the compilation and installation of MySQL 5.6.14 detailed steps" on the content of the introduction here, thank you for reading. If you want to know more about industry-related knowledge, you can pay attention to the website. Xiaobian will output more high-quality practical articles for everyone!

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