CENTOS7 Installation Configuration mysql5.6

Source: Internet
Author: User
Tags mysql client

CENTOS7 replaces the default database MySQL with MARIADB, which is not good news for those of us who want to use MySQL.

Recently I have collected a variety of online installation tutorials, a variety of problems, either the installation failed, or the installation was successful and not use MySQL. Today is finally done, so quickly share, good words don't say, start!

———————————————————————————————————————————

First, install MySQL

1. Download the installation package mysql-advanced-5.6.24-linux-glibc2.5-x86_64.tar.gz
Http://yunpan.cn/cFZhPVZ8gstJX (If you can't download it directly, you can download it by copying to the browser address bar)
Extract password 6a8b
2, the unloading system comes with the MARIADB
[[Email protected]~]# rmp-qa|grep mariadb//query out installed mariadb[[email protected]~]# pm-e--nodeps filename//One by one uninstall

3. Delete the my.cnf file under the ETC directory

[[Email protected]~]# rm/etc/my.cnf

4. Execute the following command to create the MySQL user group

[Email protected]~]# groupadd MySQL

5. Execute the following command to create a user named MySQL and join the MySQL user group

6. Put the downloaded binary compression package into the/usr/local/directory.

7. Unpack the installation package

[Email protected] ~]# TAR-ZXVF mysql-advanced-5.6.24-linux-glibc2.5-x86_64.tar.gz

8. Rename the extracted folder to MySQL

9. Create a new profile my.cnf under etc, and add the following code within the file:

[mysql]# set MySQL client default character set Default-character-set=utf8 socket=/var/lib/mysql/mysql.sock[mysqld]skip-name-resolve# Set 3306 Ports port = 3306 socket=/var/lib/mysql/mysql.sock# Set the installation directory for MySQL basedir=/usr/local/mysql# Set the data storage directory for the MySQL database datadir=/usr/local/mysql/data# the maximum number of connections allowed max_connections=200# The character set used by the service side defaults to the 8-bit encoded latin1 character set character-set-server=utf8# the default storage engine Default-storage-engine=innodb that will be used when creating a new table Lower_case_ table_names=1max_allowed_packet=16m

10. Go to install MySQL software catalog

[Email protected] ~]# cd/usr/local/mysql[[email protected] mysql]# chown-r mysql:mysql./Modify the current directory owner for the MySQL user [[Email Pro Tected] mysql]#./scripts/mysql_install_db--user=mysql Installation database [[email protected] mysql]# chown-r mysql:mysql data Modify Current DAT A directory owner for MySQL users

The installation of this database is complete!

Second, configure MySQL

1, Grant my.cnf the maximum permissions.

[Email protected] ~]# chown 777/etc/my.cnf

To set the start-Up service control script:

2. Copy the startup script to the resource directory

[email protected] mysql]# CP./support-files/mysql.server/etc/rc.d/init.d/mysqld

3. Increase MYSQLD Service control script execution permissions

[Email protected] mysql]# chmod +x/etc/rc.d/init.d/mysqld

4. Add mysqld service to system service

[Email protected] mysql]# chkconfig--add mysqld

5, check whether the MYSQLD service has been effective

[Email protected] mysql]# chkconfig--list mysqld

The command output resembles the following result:

Mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off
Indicates that the MYSQLD service is in effect and starts automatically with the system boot at the 2, 3, 4, 5 runlevel, and can be used to control the start and stop of MySQL later using the service command.

6. Start mSQL (Stop mysqld Services: Service mysqld stop)

[[Email protected] mysql]# service mysqld start

7. Add the MySQL bin directory to the PATH environment variable and edit the/etc/profile file

[Email protected] mysql]# Vi/etc/profile

At the end of the file, add the following information:

[Email protected] mysql]# export path= $PATH:/usr/local/mysql/bin

Execute the following command to make the changes take effect:

[Email protected] mysql]#. /etc/profile

8, login to the root account MySQL, the default is no password

[Email protected] mysql]# mysql-u root-p

9, set the root account password Note the following you password changed to your password to change


[[Email protected] mysql]# Update user set Password=password (' You password ') where user= ' root ' and host= ' localhost ';

10, set the remote host login (I use NAVICAT) Note the following your username and your password change to the user and password you need to set

[[email protected] mysql]# GRANT all privileges on * * to ' your username ' @ '% ' identified by ' your password ' with GRANT OPT ION;

CENTOS7 Installation Configuration mysql5.6

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.