Install PhpMyAdmin on MacOS 11 Big Sur

Maith Egeek
3 min readMay 31, 2021

Requirements

  • Install MySQL
  • Check that the 2002 MySQL Socket error is fixed : check that /var/mysql/mysql.sock links to /tmp/mysql.sock. Otherwise, type the terminal commands :
sudo mkdir /var/mysql
sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock
  • Start MySQL with the option “Use Legacy Password Encryption”: go to System Preferences > MySQL > Instances. Click on Initalize Database and select “Use Legacy Password Encryption”. Choose also a password.
System Preferences

Install

Download phpMyAdmin, the zip English package is lighter than the all languages package. Then unzip it and move the folder with its contents into the document root level (in folder ~/Sites/), renaming the unzipped folder to ‘phpmyadmin’.

Make the config folder

mkdir ~/Sites/phpmyadmin/config

Change the permissions

chmod o+w ~/Sites/phpmyadmin/config

Run the set up in the browser

http://localhost/~username/phpmyadmin/setup/

http://localhost/~username/phpmyadmin/setup/

You need to create a new localhost mysql server connection, click new server.

Switch to the Authentication tab and set the local MySQL root user and the password.
Add in the username “root” (maybe already populated, add in the password that you chose for the MySQL root user. Click save and you are returned to the previous screen which should have updated to :

Now going to http://localhost/~username/phpmyadmin/ will now allow you to interact with your MySQL databases.

It will first prompt you to input the username and password. Input root and the password you chose for MySQL.

For instance, you can import a database (a *.sql file).

First create a new database by going to the root (server:localhost). Just below Create database, input the name of your database and click “Create”.

Then select the name of the new database. Click on the import menu on the top. Click on Browse to select your .sql file. For SQL compatibility mode, select MYSQL323.

Once you click “Go”, it will display the output like this :

You can now check the imported data is correctly imported in the Browse tab.

Troubleshooting:

  • When importing a database, if the error message

MySQL said:

#1046 - No database selected

comes up, it means you did not choose database before importing. Make sure you go to the Databases tab, select one database, before going to the import tab

  • At some point I had an error message saying it can not access tmp folder. So I created a tmp folder in ~/Sites/phpmyadmin with
mkdir tmp
chmod o+w tmp
  • Unsolved issue : I still have a message on the phpMyAdmin setup page

ZIP

Zip decompression requires functions (zip_open) which are unavailable on this system.

References

--

--