Blog coding and discussion of coding about JavaScript, PHP, CGI, general web building etc.

Monday, March 14, 2016

Unable to access MySQL after it automatically generated a temporary password

Unable to access MySQL after it automatically generated a temporary password


I have erased and installed OSX 10.11 El Capitan and I have been following through this tutorial to get MySQL up and running on the new OS X. The first step was to download MySQL For Mac OS X 10.9 (x86, 64-bit), DMG Archive (works on 10.11, they recommended in the tutorial). While I were finishing installing the MySQL, I got the message saying that :

2015-10-25T02:10:54.549219Z 1 [Note] A temporary password is generated for root@localhost: R>gFySuiu23U    If you lose this password, please consult the section How to Reset the Root Password in the MySQL reference manual.  

That was weird, I have never seen that kind of message. After that, I started MySQL via the Preference Pane and then use /usr/local/mysql/bin/mysql -v command on the terminal for another step. I got an error message saying that :

ERROR 1045 (28000): Access denied for user 'cheetah'@'localhost' (using password: NO)

I have also tried to access database through Sequel Pro using root as username and blank password, I got access denied message saying that :

Unable to connect to host 127.0.0.1 because access was denied.    Double-check your username and password and ensure that access from your current location is permitted.    MySQL said: Access denied for user 'root'@'localhost' (using password: NO)  

Okay, I also tried this again using root as a username but 'R>gFySuiu23U' as a password (which was generated from MySQL). I got connection failed message saying that :

Unable to connect to host 127.0.0.1, or the request timed out.    Be sure that the address is correct and that you have the necessary privileges, or try increasing the connection timeout (currently 10 seconds).    MySQL said: Your password has expired. To log in you must change it using a client that supports expired passwords.  

How could I solve this problem? I remember that MySQL has never got automatically generated a temporary password like this, hasn't it ?

Answer by Kumar Nitin for Unable to access MySQL after it automatically generated a temporary password


Try this:

mysql -u root -h 127.0.0.1 -p  Enter password: (enter the random password here)  

Ref:https://dev.mysql.com/doc/refman/5.7/en/data-directory-initialization-mysqld.html

Following this, you may reset your password using ALTER USER 'root'@'localhost' IDENTIFIED BY 'new-password';

Answer by Cheetah Felidae for Unable to access MySQL after it automatically generated a temporary password


The another way to solve this issue is to use an older version of MySQL instead.

I have uninstalled MySQL version 5.7.9 for Mac OS X 10.9 (x86, 64-bit), DMG Archive and then install the older version, MySQL version 5.6.7 for Mac OS X 10.9 (x86, 64-bit), DMG Archive. This issue is solved. The given autogenerated password before finishing installation of this older version is gone and I can ultimately access the database using root as username and a blank password. Everything is working like a charm!

Answer by Anton Nikiforov for Unable to access MySQL after it automatically generated a temporary password


Now that the password MySQL had generated is expired, the problem is reduced to getting this password to work again (1) or generate a new one (2). This can be accomplished by running MySQL with the skip-grant-tables option which would make it ignore the access rights:

  1. Stop your MySQL server.

  2. Add skip-grant-tables at the end of the [mysqld] section of my.cnf file and save it.

  3. Start MySQL server.

  4. In terminal, type

    mysql -u root -p

to get into MySQL command prompt.

  1. In the command prompt, type

    USE mysql;

to get into the mysql database where it keeps database users.

  1. Type

    UPDATE user SET password_expired = 'N' WHERE User = 'root';

to let MySQL know the password is not expired (1) or

UPDATE user SET authentication_string = PASSWORD('YourNewPassword'), password_expired = 'N' WHERE User = 'root';  

to assign a new password YourNewPassword to root (2).

Answer by james meek for Unable to access MySQL after it automatically generated a temporary password


Answer 7 worked for me: El capitan, MySQL installed from dmg and autogenerated password, but made sure to cd to /usr/local/bin/mysql before entering ./mysql -root -p Obvious, but I didn't the first time.

Now to find where all my databases and tables are and how to link them in.

Answer by Lesley for Unable to access MySQL after it automatically generated a temporary password


This is what worked for me on OS X Yosemite running MySql v5.7 (installed from the .dmg).

cd /usr/local/mysql/bin  mysql -u root -p --connect-expired-password  

(Enter the temporary password generated by the installer.)

This gets you into sandbox mode and mysql> prompt. Then set desired root password with SET PASSWORD:

SET PASSWORD FOR 'root'@'localhost' = PASSWORD('mySuperSecretPassword');  


Fatal error: Call to a member function getElementsByTagName() on a non-object in D:\XAMPP INSTALLASTION\xampp\htdocs\endunpratama9i\www-stackoverflow-info-proses.php on line 72

0 comments:

Post a Comment

Popular Posts

Powered by Blogger.