After I installed Apache2, MySQL, MySQL Client, phpMyAdmin and PHP on my Ubuntu 13.10, I tested the Apache2 using and it works. I would like to learn how I can access MySQL and create PHP scripts for my testing website and upload to a web server.

Your help and information is greatly appreciated.


You can access MySQL from command line by typing in a terminal:

mysql -u [username] -p [password]

where [username] is the user you setup during install and [password] is the password for that user. If the password has special characters (such as $ or !) then you can leave the -p blank and it will prompt you for the password.

As far as phpMyAdmin, you need to edit the default Apache2 conf (usually located at /etc/apache2/apache2.conf or /etc/apache2/apache.conf). Make a backup (cp /etc/apache2/apache2.conf /etc/apache2/apache2.conf.bak) add these lines to the end of apache2.conf:

# Include phpmyadmin

Include /etc/phpmyadmin/apache.conf

Save the file. Then, restart Apache2 with:

service apache2 restart

Now, you should be able to access phpMyAdmin by typing http://localhost/phpmyadmin in the address bar of your browser. I hope this helps.

  • Thanks for the information I got permission denied when I tried to copy the file to backup cp /etc/apache2/apache2.conf /etc/apache2/apache2.conf.bak Regards, Inung – user3528144 Apr 22 '14 at 1:42
  • I got unknown database when I enter mysql -u [username] -p [password] – user3528144 Apr 22 '14 at 1:44
  • Sorry, you need to do all these commands as sudo or as root. – ChrisR. Apr 22 '14 at 2:00
  • Thanks for the information and help, are there any way to use WorkBench? should I just upload myfile.php file to /etc/apache2? Thanks again for helping, Regards, Inung – user3528144 Apr 22 '14 at 2:16
  • If you are wanting to make a php file (like a page on the webserver) you can add it to the whatever the root directory of the website is (usually /var/www/). After that, my knowledge of this subject is mostly exhausted. – ChrisR. Apr 22 '14 at 3:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.