Categories
MAMP MySQL Tutorials

How to setup phpMyAdmin on a Mac with OSX 10.8 + (MAMP Part 3)

Welcome to part 3 of the MAMP tutorial. In this post we will go over setting up phpMyAdmin on your Mac’s localhost. Part 2 walks you through installing mysql on your localhost read. Part 1 shows you how to setup up Apache on your Mac.

What green means: any lines that you need to replace in this tutorial will be in green.


Step 1

Fix socket error:

sudo mkdir /var/mysql
sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock

Step 2

Download phpMyAdmin:

Go to phpMyAdmin download page and choose the file in your language. I usually download phpMyAdmin-3.5.6-english.tar.gz

Unzip the file, rename it to phpMyAdmin, and move it into your Sites folder. You may need to create a Sites folder in your users directory.

/Users/username/Sites/phpMyAdmin


Step 3

Setup phpMyAdmin config:

1. Make the config folder

mkdir ~/Sites/phpMyAdmin/config

2. Change the permissions

chmod  o+w ~/Sites/phpMyAdmin/config

Go to the new phpMyAdmin localhost URL in your browser and run the phpMyAdmin setup


Step 4

Setup phpMyAdmin settings:

1. Open your browser and go to the url

localhost/~username/phpMyAdmin/setup/

PhpMyAdmin setup

2. Click “New server”

phpmyadmin setup

3. The new page will load and click on the “Authentication” Tab

4. Enter the Mysql root user and password (this was set in the previous mysql setup tutorial)

5. Click “Save” – This will take you back to the previous screen.

phpmyadmin settings

6. Scroll to the bottom of the page and click “Save” to finish

7. A new file called config.inc.php is now created in the /config directory that we created previously. Move this file from phpMyAdmin/config/ to phpMyAdmin/

8. Delete the /config folder


Step 5

Go to your newly created phpMyAdmin:

1. Make sure your Mysql is running

sudo /usr/local/mysql/support-files/mysql.server start

2. Open your browser and go to the your phpMyAdmin url

localhost/~username/phpMyAdmin/

3. Login using your mysql username and password

Congratulations! You have now installed phpMyAdmin to run on your Mac’s localhost. Pat on the back.

Part 1: How to install Apache and PHP on a Mac with OSX 10.8 + (MAMP Part 1)

Part 2: How to setup MySQL on a Mac with OSX 10.8 + (MAMP Part 2)

Part 4: How to enable and setup php.ini on a Mac with OSX 10.8 + (MAMP Part 4)

Part 5: How to host multiple sites on your Mac (MAMP Part 5)

By Jonathan Whiting

I enjoy sharing what I am learning and hopefully it's of interest and help to you. I live in Canada with my wife. Follow me on Twitter.

53 replies on “How to setup phpMyAdmin on a Mac with OSX 10.8 + (MAMP Part 3)”

Hi Jonathan,
I tried to install phpMyAdmin. but there is a problem.
Im unable to execute this command ‘chmod o+w ~/Sites/phpMyAdmin/config’.
after run this command,config folder is still empty.

Hey, this is indeed the simplest, clearest guide to setting up MAMP I have found. Much appreciation for your work.
I worked through Parts 1, 2 and 3 without problems, until I get to Part 3,
Step 5 and cannot log into http://localhost/~richard/phpMyAdmin/
-Though I see “Welcome to phpMyAdmin” page and enter my username/password, I only receive ‘waiting for localhost…’ browser message; the login screen doesn’t change; no error message.
-Cookies are enabled.
-I’ve checked my /Sites/phpMyAdmin/config.inc.php file for username (‘root’ without quote marks) and password; I’m using them in the login screen (though I did try ‘richard’ as username, got same response).
-I’ve restarted Apache & and stopped/started Mysql (in that order).
-I’ve changed the config.inc.php as suggested:
$cfg[‘Servers’][$i][‘host’] = ‘localhost’;
to
$cfg[‘Servers’][$i][‘host’] = ‘127.0.0.1’;
-I checked Apache for errors with sudo apachectl -t and received the following:
“httpd: Could not reliably determine the server’s fully qualified domain name, using Richard-Prices-Computer-4.local for ServerName
Syntax OK.” I don’t know if this means anything is wrong or not.
-I’ve tried everything except resetting the mysql password (your first reply to a question). i’m afraid I’m command line ignorant; I couldn’t get those commands to work in Terminal.
-I’m at wits end. Any help?
Thanks,
Richard

Argh. Okay. Figured it out. Disregard my post of yesterday.
I had left my “User for config auth” in the Authentication tab of the “Add a new server” screen set to ‘root’ (failed to change it to my username). Now all is well to this point!
Amazing what a few hours break will do, that plus a 2nd walk thru the steps.
Richard

Hi Richard,

Sorry for the late response. It is amazing what a couple hours away will do. I’m constantly surprised by that myself. Thanks for taking the time to comment. Have a great day.

Hi Jonathan,

Thanks very much for the great tutorial.

I have a problem

Not able to login to phpMyAdmin

I have already changed
$cfg[‘Servers’][$i][‘host’] = ‘localhost’;
to
$cfg[‘Servers’][$i][‘host’] = ‘127.0.0.1’;
as per your previous posts. But still it doesn’t work
Can you help me to solve this. I have an interview coming up within 3 days, so I trying to setup and learn php and mysql. Please help me. This is going to be a life saver for me
Thanks Jonathan

Biju

Hi Biju,

Will send you a private email tonight, hopefully will be able to help you resolve this.

Just want to echo others. These MAMP install guides are among the most useful documents on the subject. I thought I’d have to get all proprietary with Zend (boo demise of community edition) or use my yahoo host to get started. Found your docs and I was up an running in minutes while learning a bit along the way. I’ll certainly be looking to see what other wisdom you have made available. Thanks.

Thanks so much! Greetings from Nigeria, Africa. This is the most helpful tutorial on Mac. Please keep up the good work.

Hey, I’ve got a big one. It doesn’t matter how many times i set up the password, it won’t tell me anything but wrong password. I reset it, and it still asks for the new one.
Help me out, please.

Hope you were able to resolve this. It is possible that your may need to edit your /Sites/phpMyAdmin/config.inc.php file

Update the following line from:

$cfg[‘Servers’][$i][‘host’] = ‘localhost’;

to:

$cfg[‘Servers’][$i][‘host’] = ‘127.0.0.1’;

Let me know if this worked for you

please disregard my last question about username. I’ve verified in the config file what my username and password are. However, I’m still not seeing anything happen after I enter the my username and login.

Hi Vick. You will need to make sure the phpMyAdmin configuration file is setup correctly. Take a look at /Sites/phpMyAdmin/config.inc.php to verify. Hope that helps

Great tutorial. The best by far. One problem for me: In the last step, nothing happens after I input the username and password. What is the MySQL username? is it the same as my username on my macbook? Where were we asked to create a MySQL username?

Until I found your tutorials I meant to say. Once I did it was easy peasy even for a Terminal newbie. Thnx again!

Thanks Freddy, You probably found it doesn’t take long to get your bearings with Terminal. Best of luck with your setup

Hi Tyler,

It’s hard to diagnose without seeing your setup. That is the right address so it should be working.

phpMyAdmin has their own documentation that might be of help to you

go to http://localhost/~username/phpMyAdmin/Documentation.html

Wheewww… 3 hours and 5 different web-tuts later, you have finally got my headache solved. Thank you so much Jonathan for this tutorial, you saved me!

No on to learning how to create and or import my clients database.

Hey Jonathan,
Thanks for the tutorial.
Im a bit stuck though at one step. First I didn’t manage to “fix the socket error” at the beginning, nothing happened when I typed it at the terminal. Then I followed the other steps, however, when I try to go to “http://localhost/~laurasantana/phpMyAdmin/setup/” it says I dont have permission:
Forbidden

You don’t have permission to access /~laurasantana/phpMyAdmin/setup/ on this server.
Even though I followed the step on changing permissions. can you help me out a bit?

Hi Laura. It’s possible you may need to change the permissions of the phpMyAdmin folder. This will give Apache permission to access these files. Run the following in your Terminal.

cd /Users/username/Sites/
sudo chown -R :_www phpMyAdmin
sudo chmod -R g+w phpMyAdmin

Hi Manuel, try restarting Apache? Also does the /~username/phpinfo.php file work for you?

Hi Manuel, Also try running the following command to see if there are any errors in the configuration files.

sudo apachectl -t

Let me know if any errors show up.

MacBook-Pro:Sites USERNAME$ sudo apachectl -t
httpd: Syntax error on line 131 of /private/etc/apache2/httpd.conf: Could not open configuration file /usr/conf/extra/httpd-phpmyadmin.conf: No such file or directory

The /conf/ directory doesn’t exist (I checked) What do I do?

Hi Kinect3000,

Can you share line 131 of your configuration file. It’s a syntax error which likely means a file path is wrong. Easy to fix.

Include conf/extra/httpd-phpmyadmin.conf
LoadModule proxy_http_module libexec/apache2/mod_proxy_http.so

#1045 Cannot log in to the MySQL server

still getting what can i doo

/* Servers configuration */
$i = 0;

/* Server: localhost [1] */
$i++;
$cfg[‘Servers’][$i][‘verbose’] = ”;
$cfg[‘Servers’][$i][‘host’] = ‘localhost’;
$cfg[‘Servers’][$i][‘port’] = ”;
$cfg[‘Servers’][$i][‘socket’] = ”;
$cfg[‘Servers’][$i][‘connect_type’] = ‘tcp’;
$cfg[‘Servers’][$i][‘extension’] = ‘mysqli’;
$cfg[‘Servers’][$i][‘auth_type’] = ‘cookie’;
$cfg[‘Servers’][$i][‘user’] = ‘root’;
$cfg[‘Servers’][$i][‘password’] = ‘1111’;

/* End of servers configuration */

$cfg[‘blowfish_secret’] = ’51a1c71db0f361.43788765′;
$cfg[‘DefaultLang’] = ‘en’;
$cfg[‘ServerDefault’] = 1;
$cfg[‘UploadDir’] = ”;
$cfg[‘SaveDir’] = ”;
?>

I just wanted to mention that logging in to phpMyAdmin gave me the following error:
#2002 Cannot log in to the MySQL server

This can easily be fixed by changing a line in the config.inc file:

Line 14 before:
$cfg[‘Servers’][$i][‘host’] = ‘localhost’;

Line 14 after:
$cfg[‘Servers’][$i][‘host’] = ‘127.0.0.1’;

Thanks for the great tutorial!

Hello Jonathan,

First of all, thank you for posting this guide. Helped me a lot. I have a problem in logging in. Looking through the web, I found a ton of useless advice, followed most of them and I’m still having the same problem.

I get this – #1045 Cannot log in to the MySQL server – can you advice what could I possibly be doing wrong in my setup? I really will appreciate it if you can respond to this.

Thank you.

MySQL doesn’t allow blank passwords by default. You can change that setting. Is your mysql password set correctly?

The error seems like a password error.

Try resetting your password.
mysql -uroot
SET PASSWORD FOR ‘root’@’localhost’ = PASSWORD(‘your password here’);
flush privileges;
exit

mysql -u root -p xxxx

Leave a Reply

Your email address will not be published.