Mariadb Initial Landing Error Error 1045 (28000) workaround

Source: Internet
Author: User

Today, the MySQL database needs to be used in the test environment, so I quickly deployed the MARIADB using the Yum installation method. The Linux system version used is CentOS 7.x.

After the installation, I naturally use the MySQL command to log in, because it is the initial installation of the environment, the results of an error:

[[email protected] ~]# Mysqlerror 1045 (28000): Access denied for user ' root ' @ ' localhost ' (using Password:no)

The first time you encounter this situation. I checked the configuration file, did not find the exception, in addition Yum installation, is also the initial environment, should not have problems. Helpless only to find the relevant cases of the Internet to try.

Fortunately, this problem has been solved successfully in the end.

The steps to resolve are as follows:

1, first stop the database service:

[Email protected] ~]# Systemctl stop Mariadb.service

2. Use Mysqld_safe to start the MYSQLD server:

[[email protected] ~]# mysqld_safe--user=mysql--skip-grant-tables--skip-networking &[1] 4120[[email protected] ~] # 170301 11:04:57 mysqld_safe Logging to '/var/log/mariadb/mariadb.log '. 170301 11:04:57 mysqld_safe Starting mysqld Daemo N with Databases From/var/lib/mysql

3, Login:

[Email protected] ~]# mysql-u root mysqlreading table information for completion of table and column namesyou can turn O  FF This feature-get a quicker startup With-awelcome to the MariaDB Monitor. Commands End With; or \g.your MariaDB connection ID is 1Server version:5.5.52-mariadb MariaDB servercopyright (c), Oracle, Mariad B Corporation Ab and others. Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement. MariaDB [mysql]>

4. Change the root user password:

MariaDB [mysql]> UPDATE user SET Password=password (' NewPassword ') where user= ' root '; Query OK, 4 rows Affected (0.00 sec) rows Matched:4 changed:4 warnings:0mariadb [mysql]> FLUSH privileges; Query OK, 0 rows Affected (0.00 sec) MariaDB [mysql]> quitbye[[email protected] ~]#

5. Log in to the database using the modified root user and the new password NewPassword:

[Email protected] ~]# Mysql-uroot-penter password:welcome to the MariaDB Monitor. Commands End With; or \g.your MariaDB connection ID is 6Server version:5.5.52-mariadb MariaDB servercopyright (c), Oracle, Mariad B Corporation Ab and others. Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement. MariaDB [(None)]>


To this, the problem solved successfully!


This article is from the "Yangbin" blog, make sure to keep this source http://13683137989.blog.51cto.com/9636221/1902267

Mariadb Initial Landing Error Error 1045 (28000) workaround

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.