Some experience in Alibaba Cloud server configuration-2, (transfer)

Linux CentOS installation and configuration of MySQL database

Nothing to say, just straight to the front.


install mysql database

  a) Download the mysql source installation package: wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm

  b) Install mysql source: yum localinstall mysql57-community-release-el7-8.noarch.rpm

    If complete! appears at the end, the MySQL source installation is complete

   c) Check whether the installation is complete: yum repolist enabled | grep "mysql.*-community.*"

  

  d) Install mysql: yum install mysql-community-server

    If Complete! appears at the end, the MySQL installation is complete

 

  e) Set to start the mysql service: systemctl enable mysqld

   f) Check the installed mysql version: rpm -aq | grep -i mysql

    

  g) Start the MySQL service: systemctl restart mysqld

  h) View MySQL initial password: grep 'A temporary password' /var/log/mysqld.log

    

  i) Change MySQL password: mysqladmin -u root -p 'old password' password 'new password'

    

    There is a problem with changing the password here, and the change fails because the password is too simple. There are two workarounds:

    Method 1: Make the password complex (this is the most direct method)

    Method 2: Turn off mysql password strength verification (validate_password)

        Edit the configuration file: vim /etc/my.cnf, add such a line validate_password=off

        编辑后重启mysql服务:systemctl restart mysqld

  j)设置mysql能够远程访问:

    登录进MySQL:mysql -uroot -p密码

     增加一个用户给予访问权限:grant all privileges on *.* to 'root'@'ip地址' identified by '密码' with grant option; //可将ip改为%%,表示开启所有的

    

    OK,我本地连接试下。

    

好了,到这里就结束了,祝大家别出BUG。

原文地址https://www.cnblogs.com/xrog/p/6862669.html

Guess you like

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