Changed root MySQL password to an empy string now I can't access database
Changed root MySQL password to an empy string now I can't access database
I wanted to get rid of the password requirement for my MySQL and (stupidly) thought I could just change it to an empty string. I ran the command:
mysqladmin -u -p[mypassword] password ''
I received a warning message that "single quotes were not trimmed from the command line client as you would expect".
I now get access denied for all password attempts including my old password, explicitly putting in '', leaving it blank.
I have run the command mysqld --skip-grant-tables
as I have seen suggested in other questions but this has no effect, I still get access denied after running this command.
mysqld --skip-grant-tables
I have also tried following the guidance here https://dev.mysql.com/doc/refman/8.0/en/resetting-permissions.html#resetting-permissions-windows and I get the folowing output at which point the command does nothing.
C:Program FilesMySQLMySQL Server 8.0bin>mysqld --console --init-file=C:\UsersTobybDocumentsmysql-init.txt
2018-08-20T12:09:50.433487Z 0 [System] [MY-010116] [Server] C:Program FilesMySQLMySQL Server 8.0binmysqld.exe (mysqld 8.0.12) starting as process 14300
2018-08-20T12:09:52.193012Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2018-08-20T12:09:52.245255Z 6 [ERROR] [MY-011071] [Server] 1105 Bootstrap file error, return code (0). Nearest query: ''
2018-08-20T12:09:52.248615Z 0 [System] [MY-010931] [Server] C:Program FilesMySQLMySQL Server 8.0binmysqld.exe: ready for connections. Version: '8.0.12' socket: '' port: 3306 MySQL Community Server - GPL.
Is there any other way for me to regain acces to my database or change the password?
Thanks
Edit: Due to time constraints I've gone for the nuclear option and, thankfully having backup sql files, done a complete reinstall of MySQL Server. For anyone who may come across this problem and it still hasn't been solved, if you do a clean install be sure to delete all remaining MySQL Server files, otherwise the the problem will persist after the reinstall. Preferably use an uninstaller such as revo.
mysqladmin -u root -p'oldpassword' password 'newpassword'
Did you try omitting user and password? Perhaps you enabled noauth?
– Marco Yammine
Aug 20 at 12:16
@Isaac Yeah that was the page I originally followed to try and change my password to an empty string which has now led to me having no access
– TobyBBrown
Aug 20 at 13:38
Unsure as to why there isn't a failsafe to stop you creating a password, that will no longer let you login to your database.
– Isaac
Aug 20 at 13:40
My thoughts exactly! I'm fairly new to SQL/MySQL and wasn't expecting it to be so easy to lock myself out like that.
– TobyBBrown
Aug 20 at 13:48
1 Answer
1
try mysqladmin -u ,'' is not empty password
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Have you tried
mysqladmin -u root -p'oldpassword' password 'newpassword'
just taking a look at this source here. Seems like you may have read through it though. serverfault.com/questions/103412/…– Isaac
Aug 20 at 12:16