Up until today MYSQL was working OK for months with 2 MAMP Drupal localhost builds.
But now MYSQL no longer loads.
When opening MAMP the Apache Server starts,
whereas the MYSQL Server does not start.
This means the "Open WebStart page" option is greyed over and the Drupal path that would normally load the site just displays an error.
Using Terminal, if I run:
which mysql
the response is:
/Applications/MAMP/Library/bin/mysql
But if I try to login into MYSQL via Terminal:
mysql -u (myuser) -p
I am prompted for the password, but after entering correct password I receive:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket
'/Applications/MAMP/tmp/mysql/mysql.sock' (2)
I checked that path, and there is no mysql.sock file there. In that directory there is just one file titled .dummy that has no content in it.
Some forums relating to the same error suggest I check and stop any other running MYSQL instances, but I don't appear to have any.
For example I ran:
ps -ef | grep mysql
And I just receive this:
501 11212 10699 0 12:31pm ttys000 0:00.00 grep mysql
I don't entirely understand that response, but it looks like there is nothing running that I can 'kill'.
Also, if I try things like:
sudo service mysql start
I am prompted for my Mac user password, which I enter, but I am then given the error:
sudo: service: command not found
Any help here would be greatly appreciated.
EDIT: I ran:
mysqld
And received a lot of information! Too long to paste here,
but some things I noticed were:
2019-02-14T03:01:33.211495Z 0 [Note] --secure-file-priv is set to NULL.
Operations related to importing and exporting data are disabled
I don't know how to address the above, but it sounds like it's not helping the situation?
Further on from there, the first 'warning' from the list was:
[ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
I followed that advice and ran:
mysql_upgrade
and received this error:
mysql_upgrade: Got error: 2002: Can't connect to local MySQL server through socket '/Applications/MAMP/tmp/mysql/mysql.sock' (2) while connecting to the MySQL server
Upgrade process encountered error and will not continue.
Any ideas as to how to fix that?
Some other errors I noticed are:
[ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
[ERROR] Fatal error: Failed to initialize ACL/grant/time zones structures or failed to remove temporary table files.
[ERROR] Aborting
followed by a lot of lines of "shutting down plugin...(various)..." that ended in:
mysqld: Shutdown complete
Again, I am completely lost here?
After hours of trying out suggestions from various forum threads, such as:
Creating my.cnf files; or
Adjusting the MAMP php.ini file with extra code, or
Reinstalling MAMP again,or
Dumping the "ib_logfile.." files from the MAMP/db/mysql57 directory,
The only thing that finally resolved this for me was:
I suddenly remembered I copied all my working files to a backup.
so I checked the backup directories for MAMP/db/mysql57 and noticed there was a lot of content in there that for some reason was now missing from my live version,
so I deleted everything in the current MAMP/db/mysql57 directory and pasted all the backup items in.
Suddenly MAMP's MYSQL server lights up, the Startup page auto loads into my browser and I can run drush commands in my CLI and load the Drupal CMS again.
Happy Days!
Related
I have successfully been using XAMPP on my windows 10 PC to run a website that I am working on locally until today.
When I try to start MySQL, it fails. The error logs state:
mysqld.exe: Table '.\mysql\db' is marked as crashed and last (automatic?) repair failed
Fatal error: Can't open and lock privilege tables: Table '.\mysql\db' is marked as crashed and last (automatic?) repair failed
As I try to fix this, I attempted the following:
mysqlcheck --repair --use-frm --all-databases
but this gives me the following error:
Got error: 2002: Can't connect to MySQL server on 'localhost' (10061) when trying to connect
Which I guess makes sense because the mysql service isnt able to run.
I have also tried running the following from this directory: c:\xampp\mysql\data. Doing this results in an error saying 'db' doesnt exist.:
myisamchk -r db
I noticed that i have a db.MAD file that is rather large 174,616K, so not sure if that is the problem.
I ran into the same problem here is what I did:
Find and open the 'my.ini' file with Notepad. (Mine is at c:\xampp\mysql\bin\my.ini )
Insert 'skip-grant-tables' in the 'my.ini' file on a new line following the label '[mysqld]' and save. You will remove this after the problem is fixed.
Now mySQL you can start XAMPP from the control panel.
Start phpMyAdmin from your browser and select the table 'db' from the database 'mysql'
(Select 'mysql' from left panel then check 'db' in right hand panel).
Beneath from the 'With selected' dropdown, run 'analyze' (it should say that it is corrupted). Then select again and run 'repair table'.
Find the 'my.ini' file again and open with Notepad.
Remove 'skip-grant-tables' in the 'my.ini' file and save.
Problem should be fixed and you should be able to start XAMPP normally which will start MySQL normally.
i have been spending hours figuring out problems in connection mysql to use mariadb eventually. here's a situation.
situation:
1.i use macbook, and i am not that familiar with computer programming.
i tried to connect java eclipse and mariadb. so i looked it up online.
and at the same time, i opened up terminal and started my mysql using
mysql.server start
and it worked. and i was supposed to download mariaddb.2.2 jar something to connect it with eclipse, but i mistakenly downloaded "mariadb-10.2.12-osx10.13-x86_64.pkg" and installed it. and i also typed
mysql.server stop
and all that kind of things. lots and lots of things so that i can`t even remember
after i found out i downloaded the wrong things, i felt like this is way beyond my skills, so i jumped back to play with mariadb.
i opened up terminal and typed
mysql.server start
and termial keeps showing me this until now
.180322 00:04:47 mysqld_safe Logging to '/usr/local/var/mysql/sinjinhos-MacBook-Air-146.local.err'.
180322 00:04:47 mysqld_safe Starting mysqld daemon with databases from /usr/local/var/mysql
. ERROR!
i still think that this tragedy started beacause i installed mariadb again...
i literally tried everything and still couldn`t figure it out.
please help me!!
From your initial post you can see that mariadb is logging the following file.
180322 00:04:47 mysqld_safe Logging to '/usr/local/var/mysql/sinjinhos-MacBook-Air-146.local.err'
Inside that file you found the following error.
2018-03-22 0:36:36 140736284734272 [ERROR] Can't start server: Bind on TCP/IP port. Got error: 48: Address already in use 2018-03-22 0:36:36 140736284734272 [ERROR] Do you already have another mysqld server running on port: 3306 ? 2018-03-22 0:36:36 140736284734272 [ERROR] Aborting
The key part of the error is Address already in use. Everything running on your computer that listens for connections (like a database or a web server) will listen on a specific port. MySQL (and therefore MariaDB) listens on port 3306 by default. The important part is that you can't have multiple applications listening on the same port!
So where do you go from here? I suspect you still have MySQL running on your laptop, and once you stop it you will be able to start up a new instance.
To check if MySQL is running you can use the following command:
ps -ef | grep mysql
If anything shows here then it is running, and you should stop the service. How you do this will vary depending on how you installed it - try mysql.server stop first and run the above command again. If it is still running and you can't figure it out then you can kill the service. This is not recommended and cause MySQL data corruption - although if you have no data there then you should be OK.
Example output of ps -ef. Yours should show MySQL near the end, and the second column shows the process ID which you can use to kill the process.
PID
\/
0 9504 9491 0 3:44pm ttys007 0:00.00 ps -ef`
So I would use:
kill 9504
You should then be able to start the service again.
mysql.server start
I'm installing Apache server, php, and MySQL on Windows10.
First two was successful but MySQL has a problem.
I installed MySQL into C:\mysql-5.7.10-winx64, and changed my.ini like this
basedir = C:/mysql-5.7.10-winx64
datadir = C:/mysql-5.7.10-winx64/data
port = 3306
I succeeded install but if I try to start, it shows like below
C:\Windows\system32>net start mysql
The MySQL service is starting.
The MySQL service could not be started.
The service did not report an error.
More help is available by typing NET HELPMSG 3534.
However, if I check Computer Management>Event Viewer>Custom Views>Summary page events, it tells me "failed to set datadir to C:\mysql-5.7.10-winx64\data\"
If I make data folder manually, error message changed to
Can't open the mysql.plugin table
Please run mysql_upgrade to create it.." and some files are created in data folder
I tried to upgrade by typing mysql_upgrade but it failed.
mysql_upgrade: Got error: 2003: Can't connect to MySQL server on 'localhost' (10061) while connecting to the MySQL server. Upgrade process encountered error and will not continue.
How can I solve this issue?
Clear the "data" directory, then run command mysqld --initialize, and the command net start mysql, bingo!
1.For the error,
2003: Can't connect to MySQL server on 'localhost' (10061) while connecting to the MySQL server. Upgrade process encountered error and will not continue.
I ran the cmd as administrator and then go to \Program Files\MySQL\MySQL Server 5.7\bin\, and run
mysqld install
2.For the error,
C:\Program Files\MySQL\MySQL Server 5.7\bin>net start mysql
The MySQL service is starting.
The MySQL service could not be started.
The service did not report an error.
More help is available by typing NET HELPMSG 3534.
Try
mysqld --initialize
and then
net start mysql
Thanks to Athan's answer. Those combination worked for me.
I also had the same problem and I wasted hours solving the issue, but in the end this worked.
Go to you C:\ProgramData\MySQL\MySQL Server 5.7 and copy the my.ini file from there.
Go to C:\Program Files\MySQL\MySQL Server 5.7 and paste it there.
Open cmd and run net start mysql
It would work like a charm.
Explanation:
MySQL couldn't find my.ini, therefore tried to create data in Program Files... where it had no rights to do so, therefore it says access denied every time you run it.
This is old but I was running into the same problem you were seeing. I thought I'd share this answer for anyone looking. I created the data directory as you did initially and tried to start the service and got "Can't open and lock privilege tables: Table mysql.user doesn't exist." I then deleted the contents of the data directory and instead initialized the data directory by running the following command from the bin folder.
mysqld --initialize [with random root password]
mysqld --initialize-insecure [without random root password]
I had the same error, after checked this document: https://dev.mysql.com/doc/refman/8.0/en/data-directory-initialization.html
I just clear data directory and add the --console option to initialize:
bin\mysqld --defaults-file=C:\my.ini
--initialize --console
Hope this help
MySQL Server can either be run as a Program or as a Service. You cannot run both. You should stop 'mysqld' Server Program before starting 'mysqld' Server as Service.
The 'mysqld' Server Program can be stopped either by typing
'CTRL + c' or by issuing
'mysqladmin -u root -p shutdown' command and issue the password when prompted.
You need download from https://dev.mysql.com/downloads/mysql/ previous GA versions, and after that copy directory "data" to your new mysql or outher directory what you write in configfile my.ini in directory mysql-"version" .
For your error, main cause is in your my.ini setting.
Since you are installing MySQL on Windows, you should define path like:
basedir = C:\\mysql-5.7.10-winx64
datadir = C:\\mysql-5.7.10-winx64\\data
These slashes must be doubled.
Then start your MySQL service again. I guess this time would work.
And here is official document from MySQL.
This saved my life,
Just turn off the windows firewall and Give he port number correctly as 3306 as default, then restart MYSQL server . After that turn on the windows defender firewall
Just work it fine.
Looks like my solution is not added yet,
I've installed mysql80 , edited my.ini in windows notepad and got the same error like topic author "... NET HELPMSG 3534." when I start mysql service,
and my issue was in extra bytes added by notepad at the begining (EB BB BF) on my.ini, when I edited (added the same changes) my.ini in other editor everything worked fine.
I have just upgraded to Kubuntu 15.04 and MySQL is no longer working properly. The error is:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket
'/var/run/mysqld/mysqld.sock' (2)
I have checked and there is no mysqld.sock file at that location (and no directory 'var/run/mysqld'). I've tried creating a directory at 'var/run/mysqld' and using chmod to make it writable by all, then restarting MySQL using 'sudo service mysql restart', but this doesn't solve the problem.
MySQL seems to be running (it's coming up as loaded & active when I run 'sudo service mysql status'). There's nothing in the MySQL error log.
I can't find any mysqld.sock file at all (did a search across the whole file system).
Any solutions before I give up and purge/reinstall mysql would be gratefully appreciated!
EDIT to add:
The MySQL process itself isn't in the process list. No errors are thrown when I start/restart MySQL using 'sudo service mysql', and /var/log/mysql/error.log is empty.
I managed to get it working by changing the permissions on /var/lib/mysql and then running "mysqld" at the command line
So presumably some sort of permissions screw-up that happened as part of the Kubuntu upgrade.
I have been using the LAMP stack on a Ubuntu setup.
It has been working fine, set up multiple databases everything is going fine, and then suddenly this morning I started getting database errors from the webpage I was using, then trying to access PHPMyAdmin got:
error #2002 Cannot log in to the MySQL server
I go into the bash prompt and try to log-in as the root user see whats up I get a similar error:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111)
I checked that the mysql.sock file existed which it does, in the specified path in the error above. Permissions where all good, and owned by mysql. I reset the permissions just in case and still get the same error.
Here is the file as seen from BASH:
srwxrwxrwx 1 mysql mysql 0 Oct 21 05:10 mysqld.sock
I thought I would just restart the service, but get the same error when trying to stop, start or restart the service.
This really baffled me, I am no expert with linux or anything, but don't understand how this can suddenly happen when I didn't change any of the config settings, and it was running perfectly fine for the last few months.
I tried restarting Apache, and got the error:
apache2: bad user name ${APACHE_RUN_USER}
I don't think that is related to the MySQL stuff but thought it could be involved. The Apache error seems to more be with the set-up but knowing my luck being lazy has caused my to overlook simple things that has caused it all to come crashing down.
Any help on how to fix the problem, and more importantly prevent this occurrence the future would be greatly appreciated.
I have tried most things that were returned by a basic Google search, and a look around here. I have not yet tried deleting and recreating the sock file, but most other things so far have not worked.
EDIT:
I just wanted to add that the Apache server is still running fine, nothing wrong there even though I do get the error when trying to stop and restart it. Pages that don't rely on MySQL still load without issue.
I have also tried killing mysql processes through searching the PIDs and also as suggested below killall mysqld (and also killall mysql just for kicks). No processes found through these attempts.
I don't know if it is relevant or not, but I can't open (in vim) or view the mysqld.sock file (permission denied) even when using the superuser.
Have you tried using
killall mysqld
to kill the server instead of just ending the service, and then starting the MySQL service?
Or you could try deleting mysql.sock using
rm /var/run/mysqld/mysqld.sock
Then you would just need to run the MySQL server again by either starting the service or running
mysqld
It should create a new /var/run/mysqld/mysqld.sock for itself and all should go well.
Just a thought: this may have happened because the computer wasn't powered-off correctly, or perhaps MySQL just got a bit confused.
Create one micro instance swap space in Ubuntu
dd if=/dev/zero of=/swapfile bs=1M count=1024
mkswap /swapfile
swapon /swapfile
did you try to just restart the mysql server
/etc/init.d/mysqld restart
/etc/init.d/mysqld stop
/etc/init.d/mysqld start