I am following this tutorial to setup a WordPress website on Google cloud:
Process to Reset MySQL Root Pass in Mac: Make sure you have Stopped MySQL first (above). Run the server in safe mode with privilege bypass: sudo mysqldsafe -skip-grant-tables. In a new window connect to the database, set a new password and flush the permissions & quit: mysql -u root. For MySQL older than MySQL 5.7 use. MySQL has no limit on the number of databases. The underlying file system may have a limit on the number of directories. You can also use the mysqladmin program to create databases. See Section 4.5.2, “mysqladmin — A MySQL Server Administration Program”.
Now I am trying to install MySQL server on my mac. I have downloaded the Mac OS X 10.9 (x86, 64-bit), Compressed TAR Archive here: http://dev.mysql.com/downloads/mysql/
As the tutorial says, I am command the following line in my Terminal:
Start “Terminal”, write these commands and press after each “Enter”: mysql.server start; mysql.server stop; mysql.server restart. In truth, this article is rather a superficial material for beginners who are faced with the problem of running a database on their Mac. This article will show you how to set up a container with MySQL 8.0 on macOS 10.14 Mojave, but these steps will work with MySQL 5.6 or 5.7 as well as all versions of macOS capable of running. If the problem persists there may be need for a remote technical intervention to the server by MySQL system specialists. Order technical support here. Categories English - EU Tags database server, Mac OS-X 10.0, MySQL vs Yosemite.
First the terminal asked for my password, and when I enter this the following error occurs:
ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)
It’s a common error , you can fix it like this
You can remove root password with this command sequence:
Looks like Mysql server has not started.
Had exactly the same issue, used the above command to fix it.
OSX 10.13.2 High Sierra
I got the exact same error when I tried to use
mariadb, which I installed with homebrew. The first thing I did after installing was:
To troubleshoot, I did:
and then I tried:
Okay, let’s go:
The best instructions I found for manually starting and stopping mariadb are paradoxically at Starting and Stopping MariaDB Automatically:
You have the option of starting the mysqld server several different
Run or invoke mysqld itself. An example of doing this is described more in Running MariaDB from the Source Directory.
Use the mysqld_safe startup script
Use the mysql.server startup script
The mysql.server script starts mysqld by first changing to the MariaDB
install directory and then calling mysqld_safe. Adding an appropriate
user line to the [mysqld] group in your my.cnf file will cause the
server to be run as that user.
If you have installed MariaDB to a non-standard location, you may need
to edit the mysql.server script to get it to work right.
mysql.server works as a standard SysV-style init script. As such you
use the script with start and stop arguments like so:
Mac terminal ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
How I solved this on my MAC + MAMP (pro) setup:
sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock /tmp/mysql.sock
Which creates a symlink from /tmp/mysql.sock to the MAMP mysql.sock
Now restart MAMP and then the error should not occur again.
Before doing anything drastic, try connecting using the loopback address
127.0.0.1 instead of the default
localhost, which would be used by default if you don’t specify
-h, connects over named pipes rather than TCP/IP. This is the error message you see if named pipes are not enabled.
If you installed Mysql through Homebrew, just run below command, that will be helpful.
brew services start mysql
You could try to switch the version of the mysql.
Below is the instruction for using HomeBrew on Mac.
First list all the versions of mysql:
Switch to an older version:
This work for me, just delete the file
$ rm /tmp/mysql.sock
$ brew services mariadb restart
Homebrew will not start the mysql server once it is installed and hence you get the error.
You just need to start the mysql service and then connect.
yes it works for me too….
but I don’t understand : in both of php.ini files conf (apache and php of MAMP) path of socket is good :
so why still looking for
Thank’s for everyone who can “eclairer ma lanterne !”