Question or issue on macOS:

  1. Mysql Mac Terminal Command Not Found
  2. Mysql Mac Terminal Commands
  3. How To Connect Php Mysql In Mac Terminal
  4. Start Mysql In Mac Terminal
  5. Where Is Mac Terminal

I am following this tutorial to setup a WordPress website on Google cloud:
https://googlecloudplatform.github.io/appengine-php-wordpress-starter-project/

Terminal

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)

How to solve this problem?

Solution no. 1:

It’s a common error , you can fix it like this

You can remove root password with this command sequence:

Mysql Mac Terminal Command Not Found

Solution no. 2:

Looks like Mysql server has not started.

Had exactly the same issue, used the above command to fix it.

Solution no. 3:

OSX 10.13.2 High Sierra
mariadb 10.2.12

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:

Mysql In Mac Terminal

To troubleshoot, I did:

and then I tried:

and:

The solution:

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
ways:

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:
mysql.server start
mysql.server stop

Solution no. 4:

The error:
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.

Solution no. 5:

Before doing anything drastic, try connecting using the loopback address 127.0.0.1 instead of the default localhost.

The name 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.

Solution no. 6:

If you installed Mysql through Homebrew, just run below command, that will be helpful.


brew services start mysql

Solution no. 7:

You could try to switch the version of the mysql.

Mysql Mac Terminal Commands

Below is the instruction for using HomeBrew on Mac.

First list all the versions of mysql:

Switch to an older version:

Solution no. 8:

This work for me, just delete the file $ rm /tmp/mysql.sock
then $ brew services mariadb restart

Solution no. 9:

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.

How To Connect Php Mysql In Mac Terminal

Solution no. 10:

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 : socket=/Applications/MAMP/tmp/mysql/mysql.sock
so why still looking for /tmp/mysql.sock ???

Start Mysql In Mac Terminal

Thank’s for everyone who can “eclairer ma lanterne !”

Where Is Mac Terminal

Hope this helps!