centos安装mysql

2019-08-26 17:00:55 浏览数 (1)

切换到/ 从https://dev.mysql.com/downloads/repo/yum/下载rpm包, 此处选择了mysql80-community-release-el7-3.noarch.rpm

1. Adding the MySQL Yum Repository
  • sudo rpm -Uvh platform-and-version-specific-package-name.rpm
2. Installing MySQL
  • sudo yum install mysql-community-server
3.Starting the MySQL Server
  • sudo 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:

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

Change the root password as soon as possible by logging in with the generated, temporary password and set a custom password for the superuser account:

shell> mysql -uroot -p

代码语言:javascript复制
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';

0 人点赞