centOS7 installation mysql8.0 perfect tutorial! ! Just follow the steps, no brain operation a success!

View firewall
systemctl status firewalld
restart firewall
systemctl Start firewalld 

1, MySQL
  first turn off the firewall
    systemctl stop firewalld

  1.1 mysql check whether the system is already installed
    grep mariadb | rpm -qa
    If the query results to prove already installed, you must first uninstall

  1.2 Uninstall MariaDB
    RPM -e - nodeps MariaDB-libs

  1.3 Since the mysql will produce temporary files stored in the / tmp folder, if a non-root administrator might not have permission, will complain
    to the tmp folder is set all the permissions
    chmod -R 777 / tmp

  1.4 install mysql client + server [need to first download the official website, and then transferred to opt file and then perform the installation]
    RPM -ivh mysql-Community Community-8.0.18-1.el7.x86_64.rpm the Common-
    RPM -ivh mysql 8.0.18-1.el7.x86_64.rpm-libs--community
    RPM -ivh MySQL-Community-Client-8.0.18-1.el7.x86_64.rpm
    RPM -ivh MySQL-Community-Server-8.0.18-1 .el7.x86_64.rpm

  1.5 aliyun install mysql-community-server-8.0.18-1.el7.x86_64.rpm error solution

    Given as follows:

      [root@localhost upload]# rpm -ivh MySQL-server-5.5.25a-1.rhel5.x86_64.rpm
      error: Failed dependencies:
      libaio.so.1()(64bit) is needed by MySQL-server-5.5.25a-1.rhel5.x86_64
      libaio.so.1(LIBAIO_0.1)(64bit) is needed by MySQL-server-5.5.25a-1.rhel5.x86_64
      libaio.so.1(LIBAIO_0.4)(64bit) is needed by MySQL-server-5.5.25a-1.rhel5.x86_64

    Solution:

      Baidu website a lot of articles, will not work, and later found to have an article written methods, the following command:
        yum install libaio
      so ok, we can proceed with the installation of mysql.
      Reference
      http://www.blogjava.net/amigoxie/archive/2013/02/22/395605.html


2, mysql Configuration
  2.1 before using mysql, mysql need to start the service:
    systemctl Start mysqld

  2.2 Get the default password
    grep "A temporary password is generated for root @ localhost" /var/log/mysqld.log

  2.3 log
    mysql -u root -p Enter a password and then 

  2.4 Change password (set to allow simple password)
     SET Global validate_password.policy = 0;
     SET = Global validate_password.length. 1;
     the ALTER the USER "the root" @ "localhost" the IDENTIFIED BY "1234"; // new password is 1234.
  exit 2.5
    exit;
  2.6 with a new password
    mysql -u root -p enter
    password enter

  2.7 mysql remote connection permissions of
    the selected database
      use mysql;
    see all users
      select user, authentication_string, host from user ;
    the default is localhost
      Update the User the SET Host = '%' the WHERE the User = 'root';
    change the encryption rule is intended to allow the use of [ simple password]
      update user set plugin = 'mysql_native_password' where user = 'root';
    refresh
      FLUSH PRIVILEGES;


  Test external network connections mysql server
  (if outside the network connection fails, the first in accordance with [Reset Password] to perform again, and then perform [Change Password statements, and the need to replace the statement content],
  but ALTER USER "root" @ "localhost " IDENTIFIED BY "1234";
  to be replaced with ALTER USER "root" @ "% " IDENTIFIED BY "1234";)

3, Reset Password
  3.1 free open default password to modify my.cnf file in /etc/my.cnf.
     vim /etc/my.cnf
  in [mysqld] add the following modules: skip-grant-tables to save and exit.

  3.2 restart the service, to validate the configuration

    systemctl restart mysqld

  3.3 landing
    mysql -u root -p // not directly hit the Enter key to enter a password

  3.4 Selecting database
    use mysql blanking the password (because it is not directly modified when encrypted login password Free) 
     Update User SET authentication_string = '' WHERE User = 'the root';
  3.5 of Exit
    Exit;
  3.6 delete the secret Free /etc/my.cnf .
  3.7 Restart Services
    systemctl restart mysqld
   3.8 landing
    mysql -u root -p // directly hit the Enter key, because just blank password.

   3.9 and above to modify the password, like repeat like a ~ ha ha!
     Global validate_password.policy = 0 SET;
     SET = Global validate_password.length. 1;
    the ALTER the USER "the root" @ "%" the IDENTIFIED BY "1234";


open the firewall (allowed through a specific port number)
Firewall-cmd = --zone public - Port-= 3306 the Add / TCP --permanent
Firewall-cmd --reload

Guess you like

Origin www.cnblogs.com/lzc55555/p/11832562.html