[Centos 7] MYSQL Installation and login issues

Source: Internet
Author: User
Tags mysql login

1. Installing MySQL 8 on Centos 7
rpm -qa |grep -i mysql  //看自己系统有没有装mysqlwget https://dev.mysql.com/get/mysql80-community-release-e17-1.noarch.rpmrpm -ivh mysql80-community-release-e17-1.noarch.rpmyum install mysql-server

Check that the MySQL installation is successful:

systemclt start mysqldsystemclt status mysqldmysqladmin --version
2. Mysql Login

The first time MySQL starts, it generates an initial password to view the initial password method:

grep -i password /var/log/mysqld.log
    1. Change root password
vim /etc/my.cnf

Add a line at the end:

skip-grant-tables

: Wq Save and exit

    1. Restart MySQL Service
systemctl restart mysqld
    1. Password-free login MySQL
mysql -u root -p

Enter directly without entering the password

    1. Set the root password to null
mysql> use mysql;mysql> update user set authentication_string=‘‘ where user=‘root‘;mysql> quit
    1. Skip-grant-tables added before deleting/etc/my.cnf
    2. Restart MySQL Service
    3. Log back in to MySQL
mysql -u root -p

or enter directly because the password is empty

    1. To modify the root password by using alter USER
mysql> ALTER USER ‘root‘@‘localhost‘ IDENTIFIED BY ‘[email protected]‘;// ‘[email protected]‘ 替换成你想设置的密码,太简单会失败。

[Centos 7] MYSQL Installation and login issues

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.