Can't run MySQL on Mac - php

I've tried install LAMP to my Mac using this tutorial. I've installed MySQL from official site to my Mac (OS X El Capitan 10.11.3). I've written aliases for mysql and mysqladmin in .bash_profile. So when I try type mysql command it responses me with
error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (38).
I've typed perror 38 and got next: Socket operation on non-socket. What's wrong?

I think mysql server is not running. Start it by
sudo /usr/local/mysql/support-files/mysql.server start and try again.
Make sure it is running by (sometimes mysqld will get killed if there is any error)
ps aux | grep mysql

Related

Mysql not working on mac Sierra after upgrading 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.

PHP with NGINX can't connect to MySQL on Mac

I'm having some difficulty setting up Nginx with PHP and MYSQL on mac, where I cannot make any connection to the database. If I spawn a server using php -S, I can connect without problem. However Nginx running on port 8080 is unable to connect at all.
I've installed (and now uninstalled) php with brew, which might be an issue because it looks like PHP comes installed on mac. Running php -v shows me running on 7.1.16, but the brew installed version was 7.2+. I have PHP-FPM running on localhost:9000.
I've checked my php.ini files, but I only see extensions for mysqli and pdo_mysql, which I've tried to enable but still no luck.
Thanks for any help.

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.

Cant configure LAMP on kali linux

Hello guys is me again now I have some problems configuring LAMP
first of all i have install everything but I cant run test.php to see if php works according to ifconfig command my addr is: 192.168.1.77 So in browser when I try to run 192.168.1.77/test.php nothing happens.I follow the instructions in this video to do that. How to set up a Debian LAMP Server
Second when I try to change the password on mysql I got this error by the way I can't do anything that has to do with mysql. when I run this command apache2 -v && mysql -v && php -v
I got this error.
Server version: Apache/2.2.22 (Debian) Server built: Feb 1 2014
21:26:04 ERROR 2002 (HY000): Can't connect to local MySQL server
through socket '/var/run/mysqld/mysqld.sock' (2)
when I try to run this command /usr/bin/mysqladmin -u root password 'mypassword' i got this error.
/usr/bin/mysqladmin: connect to server at 'localhost' failed error:
'Can't connect to local MySQL server through socket
'/var/run/mysqld/mysqld.sock' (2)' Check that mysqld is running and
that the socket: '/var/run/mysqld/mysqld.sock' exists!
I follow this guide to LAMP, Linux Apache MySQL PHP But since I have those problems with mysql i can't finish the proper configuration. so thank you very much for any help or comments have and have a nice day.
Doing a quick search might be able to point you the right direction, did you install this?
apt-get install mysql-server
It seems to be complaining about mysqld which is the mysql-server program perhaps try this too:
service mysql start
You will see this:
[ ok ] Starting MySQL database server: mysqld ..
[info] Checking for tables which need an upgrade, are corrupt or were
not closed cleanly..
Notice how it says mysqld
If that doesn't work try this maybe:
apt-get install --reinstall mysql-server
Hopefully this helps a bit
Kali blacklists services by default using sysvinit, so if you've been rebooting it could be tripping you up:
http://docs.kali.org/policy/kali-linux-network-service-policies

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