MySQL cannot login and change password

Source: Internet
Author: User

Install MARIADB, the default is no password, but generally refers to the password to be set. There are a variety of problems when you set a password, and you may not understand its rationale. I tried both methods, but failed. The following two are the methods I tried: First, the most online method is 1, enter the following instruction mysqladmin-u root-p password NewPassword But I have entered the prompt to enter the password, I entered the password but prompted the wrong, see below [[email  Protected] sakila]# mysqladmin-u root-p password newpasswdenter password:mysqladmin:connect to server at ' localhost ' fa Ilederror: ' Access denied for user ' root ' @ ' localhost ' (using Password:yes) ' 2, stop database service systemctl stop Mariadb.service3, All tables are set to login without a password. Mysqld_safe--skip-grant-tables & Execute this statement to prompt for errors [[email protected] sakila]# mysqld_safe--skip-grant-tables &[1] 14275[[email protected] sakila]# 150424 10:13:41 mysqld_safe Logging to '/var/log/mariadb/mariadb.log '. 150424 10:13:41 Mysqld_safe starting mysqld daemon with databases From/var/lib/mysql4, try to exit the database, restart the service, and then go to [[email  Protected] sakila]# systemctl restart mariadb.service[[email protected] sakila]# mysqladmin-u root-p password ' pas SWD ' Enter Password:mysqladmin:You cannot use ' password ' command as mysqld runswith Grant TAbles Disabled (was started with--skip-grant-tables). Use: "Mysqladmin flush-privileges password ' * '" instead two, correct operation 1, into the database to operate [[email protected] etc]# mysqlwelcome to The MariaDB Monitor. Commands End With; MariaDB Connection ID is 7Server version:5.5.41-mariadb MariaDB servercopyright (c) \g.your, Oracle, Mariad B Corporation Ab and others. Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement. MariaDB [(none)]> mysql->; Error 1064 (42000): You have a error in your SQL syntax; Check the manual that correspondsto your MariaDB server version for the right syntax to use near ' MySQL ' on line 1MariaDB [(None)]> Update user set Password=password ("123456") where user= ' root '; ERROR 1046 (3d000): No database Selected2, select DB mariadb [(none)]> use mysqlreading table information for completion of T Able and column namesyou can turn off this feature to get a quicker startup With-adatabase changed


Change Password


UPDATE user SET Authentication_string=password (' aaaAAA111 ') WHERE user= ' root ';


FLUSH privileges;

  

MySQL cannot login and change password

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.