When trying to start mysql, I receive the following error message:
ERROR 3118 (HY000): Access denied for user 'root'#'localhost'. Account is locked.
I've installed MySQL via homebrew on my OSX and have not encountered such an issue until yesterday. When I try to run mysqld_safe, I receive:
mysqld_safe mysqld from pid file /usr/local/var/mysql/****.pid ended.
If I try sudo mysqld stop, I receive:
Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!
I am unable to sudo restart mysql.server as I receive:
ERROR! MySQL server PID file could not be found!
I looked into running a data dump of my db but I am prevented from doing this as well.
Thanks for your attention to this matter and any insight you can provide in this matter. I greatly appreciate it.
Related
I was running DatabaseCleaner tests on Rails and ended up breaking MySQL completely. I've completely removed and re-installed it and still can't get it to run. Used brew uninstall mysql and brew install mysql to start fresh, but it's broken even upon re-install.
❯ brew services start mysql
Bootstrap failed: 5: Input/output error
Try re-running the command as root for richer errors.
Error: Failure while executing; `/bin/launchctl bootstrap gui/501 /Users/allan/Library/LaunchAgents/homebrew.mxcl.mysql.plist` exited with 5.
❯ mysql.server start
Starting MySQL
./usr/local/Cellar/mysql/8.0.31/bin/mysqld_safe: line 144: /usr/local/var/mysql/Allans-MacBook-Pro.local.err: Permission denied
/usr/local/Cellar/mysql/8.0.31/bin/mysqld_safe: line 144: /usr/local/var/mysql/Allans-MacBook-Pro.local.err: Permission denied
/usr/local/Cellar/mysql/8.0.31/bin/mysqld_safe: line 199: /usr/local/var/mysql/Allans-MacBook-Pro.local.err: Permission denied
/usr/local/Cellar/mysql/8.0.31/bin/mysqld_safe: line 144: /usr/local/var/mysql/Allans-MacBook-Pro.local.err: Permission denied
ERROR! The server quit without updating PID file (/usr/local/var/mysql/Allans-MacBook-Pro.local.pid).
❯ mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
HOWEVER if I run mysqld it actually runs and then I can access it! Does anyone know how to fix this without having to factory reset my Macbook? running Moneterey version 12.4
a few days back I let brew update all my formulars like always but this time mysqld doesn't start back up again.
This is the error message:
2016-03-22T13:58:22.515719Z 0 [ERROR] Fatal error: mysql.user table is damaged. Please run mysql_upgrade.
2016-03-22T13:58:22.515819Z 0 [ERROR] Aborting
But since I cannot get the server started, I cannot get mysql_upgrade running:
mysql_upgrade: Got error: 2013: Lost connection to MySQL server at 'reading initial communication packet', system error: 102 while connecting to the MySQL server
Upgrade process encountered error and will not continue.
So what can I do to get this working again? Would a brew uninstall mysql and reinstall help in any way?
First, start your mysql without reading the user table:
mysqld --skip-grant-tables
Then run mysql_upgrade which should now run smoothly.
Next stop mysqld: killall mysqld.
Now you should be able to start up your mysql service normally again.
I ended up renaming my database folder, run mysql_install_db, copy the new mysql database folder to my old mysql database folder and started it again. I'm sure this is hella dirty but well, it worked :)
I am attempting a fresh install of mysql on a new iMac running OSX 10.11. I downloaded the latest 10.10 dmg and followed installation directions, but when I try to run mysql, I get the
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2).
I have spent several hours reading answers here and elsewhere as to how to fix it, and nothing has worked so far.
What I know:
The /tmp/mysql.sock file has been renamed /tmp/mysql.sock.lock. Apparently, if I could get mysqld to run, it would make a new socket file, but when I try to get mysqld to run (either from the Terminal or System Preferences) it just fails and produces the same error. Likewise, when I try to run mysqladmin it fails and produces the same error.
When I run mysqld_safe, it produces the following, but doesn’t clear up the socket error:
151206 16:40:20 mysqld_safe Logging to '/usr/local/mysql/data/XXXXXXs-iMac.err'.
151206 16:40:20 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
151206 16:42:01 mysqld_safe mysqld from pid file /usr/local/mysql/data/XXXXXXs-iMac.pid ended
When I ran mysql on Lion, I was always able to clear up socket errors by running mysqld_safe.
Advice?
Run the command 'sudo mysqld' from the command line to launch the server.
I have a vps with cpanel
and I have error when I try start de mysql server
ERROR! MySQL is not running, but lock file (/var/lock/subsys/mysql) exists
root#goldtec [~]# service mysql restart
ERROR! MySQL server PID file could not be found!
Starting MySQL.. ERROR! The server quit without updating PID file (/var/lib/mysql/goldtec.net.pid).
I don't wanna lost the data
There is an issues with you my.cnf file. I will suggest you please check your MySQL error logs file, With that logs you can find out the root cause of your issues
Getting this error when trying to run the command /usr/local/mysql/bin/mysqld_safe:
mysqld_safe Logging to '/usr/local/mysql/data/Users-MacBook-Pro.local.err'.
cat: /usr/local/mysql/data/Users-MacBook-Pro.local.pid: Permission denied
rm: cannot remove ‘/usr/local/mysql/data/Users-MacBook-Pro.local.pid’:
Permission denied
140313 11:09:18 mysqld_safe Fatal error: Can't remove the pid file:
/usr/local/mysql/data/Users-MacBook-Pro.local.pid
Please remove it manually and start /usr/local/mysql/bin/mysqld_safe again;
mysqld daemon not started
/usr/local/mysql/bin/mysqld_safe: line 129:
/usr/local/mysql/data/Users-MacBook- Pro.local.err: Permission denied
Shoould I remove the file? Is it safe to remove it?
Remove this pid file, make sure all the instances are stopped (kill any processes not going down), check nothing is listening the MySQL port 3306 (netstat should help) and try to start MySQL again.
To troubleshoot this see the permission you user has on the folder where the pid needs to be stored !
Try running the command with SUDO in front of it, like this
sudo /usr/local/mysql/bin/mysqld_safe
Enter your password. This will most likely resolve your problem.
The reason you are getting these errors is because the command you are running to start mysql requires access to certain files (listed in the error message). You need root access to these files to start mysql, so by adding sudo to the start of the command, you are giving root access.