Mysqlcheck Got Error 1045 Access Denied For User Root Localhost
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might mysql access denied for user 'root'@'localhost' (using password yes) have Meta Discuss the workings and policies of this site About access denied for user 'root'@'localhost' mysql Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads access denied for user 'root'@'localhost' (using password: no) with us Super User Questions Tags Users Badges Unanswered Ask Question _ Super User is a question and answer site for computer enthusiasts and power users. Join access denied for user localhost using password yes them; it only takes a minute: Sign up Here's how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top mysql how to fix Access denied for user 'root'@'localhost' up vote 52 down vote favorite 31 Before I screw up something, when login using $
Access Denied For User ''@'localhost' To Database 'mysql'
mysql -u root -p, and show databases: +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | game_data | | test | +--------------------+ Then I try to create a new user and notice something is wrong with the PRIVILEGES. So I deleted the new users, and I guess I removed the 'root' and 'Admin' accidentally. Then I try to create 'root' again, but get Access denied error when doing grant all privileges. mysql> CREATE USER 'root'@'localhost' IDENTIFIED BY 'password'; mysql> grant all privileges on *.* to 'root'@'localhost' identified by 'password' with grant option; ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) If I login mysql again using $ mysql -u root -p, and show databases, +--------------------+ | Database | +--------------------+ | information_schema | +--------------------+ All the other databases are gone. How do I fix mysql now? I cannot cannot find the database 'mysql', cannot create database, create user, anything I try to do will get an error ERRO
Mysqlcheck command checks, repairs, optimizes and analyzes the tables. 1. Check a Specific Table in a Database If your application gives an error message saying that a specific table is
Access Denied For User 'root'@'localhost' (using Password Yes) When Trying To Connect
corrupted, execute the mysqlcheck command to check that one table. The following example access denied for user localhost using password no checks employee table in thegeekstuff database. # mysqlcheck -c thegeekstuff employee -u root -p Enter password: thegeekstuff.employee OK You should pass access denied for user 'root'@'localhost' (using password no) ubuntu the username/password to the mysqlcheck command. If not, you'll get the following error message. # mysqlcheck -c thegeekstuff employee mysqlcheck: Got error: 1045: Access denied for user 'root'@'localhost' (using password: NO) when trying to http://superuser.com/questions/603026/mysql-how-to-fix-access-denied-for-user-rootlocalhost connect Please note that myisamchk command that we discussed a while back works similar to the mysqlcheck command. However, the advantage of mysqlcheck command is that it can be executed when the mysql daemon is running. So, using mysqlcheck command you can check and repair corrupted table while the database is still running. 2. Check All Tables in a Database To check all the tables in a particular http://www.thegeekstuff.com/2011/12/mysqlcheck database, don't specify the table name. Just specify the database name. The following example checks all the tables in the alfresco database. # mysqlcheck -c alfresco -u root -p Enter password: alfresco.JBPM_ACTION OK alfresco.JBPM_BYTEARRAY OK alfresco.JBPM_BYTEBLOCK OK alfresco.JBPM_COMMENT OK alfresco.JBPM_DECISIONCONDITIONS OK alfresco.JBPM_DELEGATION OK alfresco.JBPM_EVENT OK .. 3. Check All Tables and All Databases To check all the tables and all the databases use the "-all-databases" along with -c option as shown below. # mysqlcheck -c -u root -p --all-databases Enter password: thegeekstuff.employee OK alfresco.JBPM_ACTION OK alfresco.JBPM_BYTEARRAY OK alfresco.JBPM_BYTEBLOCK OK .. .. mysql.help_category error : Table upgrade required. Please do "REPAIR TABLE `help_category`" or dump/reload to fix it! mysql.help_keyword error : Table upgrade required. Please do "REPAIR TABLE `help_keyword`" or dump/reload to fix it! .. If you want to check all tables of few databases, specify the database names using "-databases". The following example checks all the tables in thegeekstuff and alfresco database. # mysqlcheck -c -u root -p --databases thegeekstuff alfresco Enter password: thegeekstuff.employee OK alfresco.JBPM_ACTION OK alfresco.JBPM_BYTEARRAY OK alfresco.JBPM_BYTEBLOCK OK .. 4. Analyze Tables using Mysqlcheck The following analyzes employee table that is located in thegeekstuff database. # mysqlcheck -a thegeekstuff employee -u root -p Enter password: thegeekstuff.employee Table is
Email Updates: Status: Closed Impact on me: None Category:MySQL Server: Installing Severity:S3 (Non-critical) Version:5.0.32 OS:Linux (linux) Assigned to: Magnus Blåudd Tags: installation, server, upgrade View Add Comment Files http://bugs.mysql.com/25452 Developer Edit Submission View Progress Log Contributions [7 Jan 2007 5:29] Mark Johnson Description: mysql_upgrade does not pass password on to mysqlcheck. When I invoke mysql_upgrade with a password, I consistently got an access denied error. Note that the output incorrectly indicated I was not using a password. root@enterprise:/etc/rc.d# mysql_upgrade --datadir=/mnt/raid/mysqldata -p Enter password: /usr/bin/mysqlcheck: Got error: 1045: Access denied for user access denied 'root'@'localhost' (using password: NO) when trying to connect Error executing '/usr/bin/mysqlcheck --check-upgrade --all-databases --auto-repair --user=root' root@enterprise:/etc/rc.d# mysql_upgrade --datadir=/mnt/raid/mysqldata --password Enter password: /usr/bin/mysqlcheck: Got error: 1045: Access denied for user 'root'@'localhost' (using password: NO) when trying to connect Error executing '/usr/bin/mysqlcheck --check-upgrade --all-databases --auto-repair --user=root' How to repeat: Attempt to run mysql_upgrade with a --password on the command line. Suggested fix: This option should access denied for be passed to mysqlcheck with the password so that access will not be denied. [7 Jan 2007 17:56] Giuseppe Maxia Thanks for the bug report. Verified as described on 5.0.32 Enterprise. Also, on 5.1.14 (and later versions), the same application exits with a segmentation fault. [7 Mar 2007 4:24] Matthew Smith Same behaviour on 5.1.16-beta, built under Linux, using either -p or --password=. /usr/bin/mysqlcheck: Got error: 1045: Access denied for user 'root'@'localhost' (using password: NO) Unfortunately, as this is not a script, I can't just look at it and then run the commands by hand. [8 Mar 2007 11:33] Magnus Blåudd Working on new version of mysql_upgrade and has added a testcase to mysql_upgrade.test looking like this: >> # # Bug #25452 mysql_upgrade access denied. # # Password protect a root account and run mysql_upgrade CREATE USER mysqltest1@'%' IDENTIFIED by 'sakila'; GRANT ALL ON *.* TO mysqltest1@'%'; --echo Run mysql_upgrade with password --exec $MYSQL_UPGRADE --skip-verbose --force --user=mysqltest1 --password=sakila 2> $MYSQLTEST_VARDIR/log/mysql_upgrade.err DROP USER mysqltest1@'%'; << [8 Mar 2007 11:35] Magnus Blåudd The password is erased by code in get_one_option case 'p': tty_password= 1; if (argument) { char *star