First of all to say sorry to you, the original plan said every day a blog post, recently due to be too busy, closed development of a project, no time to write blog, hope everyone forgive!!!
As the company to build distributed services, I have recently used or learned the technology or encountered the problems to share with you!
Linxu Environment:
centos7:x86_64 x86_64 x86_64 Gnu/linux
Mysql:mysql-5.6.33-linux-glibc2.5-x86_64.tar.gz
Rely on MySQL dependent Libaio, so first install Libaio
Yum Search Libaio # Retrieving related information yum install Libaio # Installation Dependency Package
Successful installation, prompt as follows:
[Email protected]/]#YumInstallLibaio Loaded plugins:FastestmirrorLoadingMirrorspeeds from Cached hostfile * base: mirrors.YUN-IDC .com * extras: Mirrors.163.com * updates: mirrors .163.com Package libaio-0.3 .109-12.el7.x86_64 is installed and is the latest version without any processing
Check if MySQL is installed
Yum List Installed | grep MySQL
If so, uninstall all first, the command is as follows:
Yum -y remove mysql-libs. x86_64
If you have multiple dependent files, uninstall them in turn. When the results are displayed as complete! The uninstallation is complete.
First, install MySQL
1, download the installation package mysql-5.6.33-linux-glibc2.5-x86_64.tar.gz download the MySQL binaries to install (slightly) 2, uninstall the 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 the MySQL client default character set
Default-character-set=utf8
Socket=/var/lib/mysql/mysql.sock
[Mysqld]
Skip-name-resolve
#设置3306端口
Port = 3306
Socket=/var/lib/mysql/mysql.sock
# set up the MySQL installation directory
Basedir=/usr/local/mysql
# Set up a storage directory for MySQL database data
Datadir=/usr/local/mysql/data
# 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 that will be used when creating a new table
Default-storage-engine=innodb
Lower_case_table_names=1
max_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;//to remote access authorization
[[email protected] mysql]# FLUSH privileges; You need to enter a secondary command to make the changes effective
Attached to the installation complete diagram:
Refer to the online tutorial installation, follow this process to install is no problem, if there is a problem with a few system modules, please install yourself!
Remember to close firewall:
Systemctl Stop Firewalld.service #停止firewall
Systemctl Disable Firewalld.service #禁止firewall开机启动
Firewall-cmd--state #查看默认防火墙状态 (show notrunning after turn off, show running when turned on)
170419, Centos7 under the perfect installation and configuration mysql5.6