Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Gurinder121's avatar

Unable to connect log into mySQL

I am new to mySQL. Looks like I have to reset my password. Not sure what's going on.

Me: brew services restart mysql

The terminal: MacBook-Air:php-learning gurinderkhabra$ brew services restart mysql Stopping mysql... (might take a while) ==> Successfully stopped mysql (label: homebrew.mxcl.mysql) ==> Successfully started mysql (label: homebrew.mxcl.mysql)

me: mysql -uroot

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

0 likes
2 replies
Gurinder121's avatar

Thanks for the quick reply!

It's asking me for a password. I don't remember the password.

I use this resource to reset the password: https://stackoverflow.com/questions/10070401/mysql-root-password-forgotten

I type mysqld --skip-grant-tables

I get a continuous response from the terminal saying

sql/8.0.19/bin/mysqld (mysqld 8.0.19) starting as process 57741 2020-06-26T18:41:55.160109Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /usr/local/var/mysql/ is case insensitive 2020-06-26T18:41:55.195653Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35 2020-06-26T18:41:56.199584Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35 2020-06-26T18:41:57.203166Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35 2020-06-26T18:41:58.208397Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35 2

Please or to participate in this conversation.