Mysql not working on mac Sierra after upgrading php - php

I recently upgraded my laravel valet to version 2 which installed php 7.2 through brew. I had previously been on php 7.1. I ran into a few bumps but got php and valet working but once I did I noticed mysql is no longer working. If I do brew services start mysql it shows successful but if I type mysql -v I get the following error message. ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
If I type mysql.server start I get the following error message
./usr/local/Cellar/mysql/8.0.17_1/bin/mysqld_safe: line 674: /Users/swany/.valet/Log/mysql.log: No such file or directory
2019-09-11T17:24:54.6NZ mysqld_safe error: log-error set to '/Users/swany/.valet/Log/mysql.log', however file don't exists. Create writable for user 'mysql'.
/usr/local/Cellar/mysql/8.0.17_1/bin/mysqld_safe: line 144: /Users/swany/.valet/Log/mysql.log: No such file or directory
ERROR! The server quit without updating PID file (/usr/local/var/mysql/Chriss-MacBook-Pro-2.local.pid).
I have seen others with similar issues but when i walked through some of the solutions they didn't seem to work for me. I am hoping to be able to save all my databases I already have when mysql was running. I didn't try to upgrade mysql but it may tried as part of the valet upgrade.

Check to see if there is a mysql process still running. Run the following command:
ps aux | grep -i mysql
If you see any processes running then kill them using the
kill -9 PID
Where PID = Process ID of the MySQL process.
After the processes have been terminated, try restarting mysql and see if this solved your problem.

Related

PDOException: could not find driver after server reboot

When rebooting the server (RHEL6, Apache 2.2, PHP 7.2) I always get the error "PDOException: could not find driver". Apache is started automatically via httpd init script.
After an apachectl stop | start everything works fine.
Any ideas?
Thanks.

Can't start MySQL: "Could not find domain for" running mysql on macos (Laravel Valet)

I'm trying to get a local mysql up and running on my macos machine. I am following theese instructions: https://laravel.com/docs/5.7/valet#installation
I am installing through Homebrew.
I have tried reinstalling mysql
I have two users: an administrator to install things, and a normal user account for my developing and normal activities. Perhaps this is what's causing the issues
What I expect:
MySQL to run every time I boot up my macbook as it used to do (no matter what user account I am logged into, preferably).
Error:
When I try to connect through Sequel Pro or running mysql -u root directly, I get error: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
What I have tried
sudo brew services restart mysql#5.7. Running with success but mysql still doesn't work.
[admin:~]$ brew services start mysql#5.7 error Could not find domain for Error: Failure while executing; /bin/launchctl enable gui/501/homebrew.mxcl.mysql#5.7 exited with 112.
Followed instructions of: MacOSX: autostart mysql on boot
Tried starting manually from my normal user account: [myuser:~]$ mysql.server start error: Starting MySQL ./usr/local/Cellar/mysql#5.7/5.7.24/bin/mysqld_safe: line 144: /usr/local/var/mysql/mymacname.local.err: Permission denied
So I finally found the solution, turned out it was quite simple. I tried reinstalling several times, etc, but in the end what worked was to fix the permissions brew didn't manage to, after a installing via brew.
Running
sudo chown -R _mysql:mysql /usr/local/var/mysql
Then restarting the mysql server:
sudo brew services restart mysql#5.7
Solved the issue 🤓👍🏽

mysql connection error: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) Godaddy Cpanel

My website was working fine till yesterday. But it suddenly started showing this error:
mysql connection error: Can't connect to local MySQL server through
socket '/var/lib/mysql/mysql.sock' (2)
I don't think I made any changes except adding the site to alexa. I googled this and found a lot of resources but all those couldnt help me because I did not fully understand them. I am also not able to locate the file mysql.sock.
I want to know if my website has been hacked. Plus, the solution to the problem.
Might want to start with checking all your db configuration and make sure you did not overwrite or accidentally changed something?
If not that, then try restarting your mysql server. Not sure what Linux env your running, but whichever one it is, Google how to restart mysql.
You could also try and restarting apache. I think the command for that is
sudo service apache2 reload
sudo service apache2 restart
sudo service mysql restart
Then verify if mysql is running on the socket, run this command to see the process
ps aux | grep mysql
this is simple. Run this on commandline
mysql -uroot -p -hlocalhost
sudo service mysql restart
mysql -u root -p
I hope that works.

how can I run mysql if I installed it from MAMP

So I looked at this question Find out where MySQL is installed on Mac OS X
I have MAMP installed and when I run: /Applications/MAMP/Library/bin/mysql --version It gives me correct output for mysql version.
But if I run type -a mysql it says that it wasn't found, as if I don't have mysql installed.
If I want to run mysql from the terminal I can start my MAMP server, then go to MAMP's library and run ./mysql which will start a mysql session.
HOWEVER: I do NOT want to run it using the current MAMP's server I have. i.e Is there a way to run mysql from any directory, like without using MAMP at all?
I downloaded mysql from mysql site http://www.mysql.com and I can run either the one on my MAMP'S server or the one locally on my machine. I just need to decide which of the two since both are running locally.
you should run the daemon manually but you need to setup the data before that by doing something like data directory initialization mysqld

MySQL Database won't start XAMPP

I have updated my XAMPP version to 1.8.2. Now I have the problem that the MySQL Database-server won't start.
If I try to start the Apache Web Server (in 'Application manager'), it says "starting..." and after a few seconds it says "Running". When I do the same thing with the MySQL Database, it says "starting..." for a few seconds and then it says "Stopped".
When I look at the config file (my.cnf), I see this:
# The following options will be passed to all MySQL clients
[client]
#password = your_password
port = 3306
socket = /Applications/XAMPP/xamppfiles/var/mysql/mysql.sock
I think the problem is in the socket. mysql.sock does not exist in that directory and not even in the whole XAMPP-directory.
Does anyone know how to fix this?
PS: I have PHP 5.4 installed on OS X.
i had experienced the same error on Mac OS X (10.9) Mavericks i fixed by following these steps
Open terminal and use sudo su
Run ps aux | grep mysql
Kill all process using kill -9 PROCESS_ID
Start your MySQL using control panel
Port 3306 might be used by other process, Can just change the Port number in Xampp mysql configuration and start the mysql.
I had the same experience with xampp but I wasn't performing an update, this was a clean install. I have had good luck running MAMP right out of the box. This isn't exactly a direct answer to your problem, but if you just wanted to install something and get work done, MAMP could be an option. I did a couple of hours of googling and I still haven't figured out the xampp issue here...

Categories