Centos 安裝mysql

1.Adding the MySQL Yum Repositorymysql

First, add the MySQL Yum repository to your system's repository list. Follow these steps:sql

  • Go to the download page for MySQL Yum repository at http://dev.mysql.com/downloads/repo/yum/.
  • Select and download the release package for your platform.
  • Install the downloaded release package with the following command, replacing platform-and-version-specific-package-name with the name of the downloaded package:
    shell> sudo rpm -Uvh platform-and-version-specific-package-name.rpm
    For example, for version n of the package for EL6-based systems, the command is:
    shell> sudo rpm -Uvh mysql80-community-release-el6-n.noarch.rpmshell

    Note
    Once the release package is installed on your system, any system-wide update by the yum update command (or dnf upgrade for dnf-enabled systems) will automatically upgrade MySQL packages on your system and also replace any native third-party packages, if Yum finds replacements for them in the MySQL Yum repository. See Upgrading MySQL with the MySQL Yum Repository and Replacing a Native Third-Party Distribution of MySQL for details.ide

  1. Selecting a Release Series
shell> yum repolist all | grep mysql
shell> yum repolist enabled | grep mysql
  1. Installing MySQL
    Install MySQL by the following command (for dnf-enabled systems, replace yum in the command with dnf):
shell> sudo yum install mysql-community-server
  1. Starting the MySQL Server
    Start the MySQL server with the following command:
systemctl start mysqld.service

A superuser account 'root'@'localhost' is created. A password for the superuser is set and stored in the error log file. To reveal it, use the following command:code

shell> sudo grep 'temporary password' /var/log/mysqld.log
  1. setting

change validate_passwordorm

set global validate_password.policy=0;

Allow external accessserver

use mysql
update user set host='%' where user='root';

change identified type alter user 'root'@'localhost' identified with mysql_native_password by '123456';ci

相關文章
相關標籤/搜索