Install mysql5.7.17 and rpmmysql5.7.17 using RPM in linux
For your reference, the installation method record of mysql5.7 rpm in linux is as follows:
Delete old package:
# rpm -qa | grep -i mysql# rpm -ev mysql-libs-* --nodeps
Install the rpm package:
# rpm -ivh mysql-community-common-5.7.17-1.el7.x86_64.rpm# rpm -ivh mysql-community-libs-5.7.17-1.el7.x86_64.rpm# rpm -ivh mysql-community-client-5.7.17-1.el7.x86_64.rpm# rpm -ivh mysql-community-server-5.7.17-1.el7.x86_64.rpm
Start and Stop:
# service mysqld start# service mysqld stop# service mysqld status
Initial random password:
# cat /var/log/mysqld.log | more
Modify the initial password and authorize remote access:
# mysql -uroot -pmysql> set password='Pwd@123456';mysql> grant all privileges on *.* to 'root'@'%' identified by 'Pwd@123456';
Password Complexity attributes:
mysql> set global validate_password_policy=0;
Validate_password_policy has the following values: (the default value is 1, that is, MEDIUM. Therefore, the password set at the beginning must conform to the length and must contain numbers, lowercase letters, or uppercase letters, and special characters .)
Modify the data directory:
The new directory must be authorized to the mysql user, and the mysqld_safe log file must be authorized to disable selinux (the method for setting related policies is not found)
# mkdir /data/mysql/data# mv /var/lib/mysql/* /data/mysql/data/# mkdir /data/mysql/log# chown mysql:mysql -R /data/mysql# touch mysqld_safe.log# chown mysql:mysql mysqld_safe.log# vi /etc/my.cnf/**[client]port = 3306socket = /data/mysql/log/mysql.sockdefault-character-set=utf8[mysql]no-auto-rehashsocket=/data/mysql/log/mysql.sockdefault-character-set=utf8[mysqld]port = 3306socket = /data/mysql/log/mysql.sockcharacter-set-server=utf8lower_case_table_names=1basedir=/usrdatadir=/data/mysql/datalog-error=/data/mysql/log/error.logpid-file=/data/mysql/log/mysql.pidinit_connect='SET NAMES utf8'symbolic-links=0skip-external-lockingkey_buffer_size = 16Mmax_allowed_packet = 1Mtable_open_cache = 64sort_buffer_size = 512Knet_buffer_length = 8Kread_buffer_size = 256Kread_rnd_buffer_size = 512Kmyisam_sort_buffer_size = 8M[mysqld_safe]log-error=/data/mysql/log/mysqld_safe.log*/# getenforceEnforcing# setenforce 0# vi /etc/selinux/config/**# This file controls the state of SELinux on the system.# SELINUX= can take one of these three values:# enforcing - SELinux security policy is enforced.# permissive - SELinux prints warnings instead of enforcing.# disabled - No SELinux policy is loaded.#SELINUX=enforcingSELINUX=disabled# SELINUXTYPE= can take one of these two values:# targeted - Targeted processes are protected,# mls - Multi Level Security protection.SELINUXTYPE=targeted */# service mysqld start
Other commands:
# mysqladmin -u root -p passwordmysql> select version();# chkconfig --list# chkconfig --level 345 mysqld on# netstat -na | grep 3306
The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.