Installation of mysql5.7 and some basic settings

1. MySQL installation
(1) Check if the built-in mysql is installed --> yum list installed |grep mysql
(2) If you find your own mysql --> yum -y remove mysql-libs.x86_64
(3) Install the yum source of mysql --> rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
(4) Install yum-config-manager --> yum install yum -utils -y (5) Disable the source of mysql5.6 --> yum-config-manager --disable mysql56-community
(6) Enable MySQL5.7 source --> yum-config-manager --enable mysql57-community-dmr
(7) Use the following command to check whether the configuration is correct --> yum repolist enabled |grep mysq (8) Install mysql5.7 --> yum install mysql-community-server
(9)禁用selinux      -->  setenforce 0                                                                                                                                                                                      sed -i '/^SELINUX=/c\SELINUX=disabled' /etc/selinux/config
(10) Start mysql --> service mysqld start

2. For the problem of changing the mysql password, you need to check the login and change it
(1)set global validate_password_policy=0;
  (2)   set global validate_password_length=1;
  (3) ALTER USER 'root@localhost' IDENRIFIED BY '12345678'; Change the password to 12345678 3. Change the mysql character set to prevent garbled characters
(1) First enter the mysql console mysql -uroot -p and enter the password at the following command line (2) Modify the mysql configuration file vi /etc/my.cnf
  Add a code block under [client] ([client] may not exist, you need to create it yourself):
  default-character-set=utf8
  Add a code block under [mysqld] section:
  default-storage-engine=INNODB
  character-set-server= utf8
  collation-server=utf8_general_ci
  :wq! #Save and exit
   (4) Restart mysql service mysql restart to enter the client mysql -uroot -p
        Then enter show variables like 'character_set_%' to see if the format is utf8
4. Steps to use the database
(1) show databases shows all databases
  (2) create database griezmann
(3) use griezmann to enter the database Griezmann
(4) show tables displays all the tables under the database

 


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324402604&siteId=291194637