Local MySQL database

 

Run a MySQL database locally, without paying for a domain!

If you want to run a web server for MySQL or simply running a website, you can host it on a computer you already own! Using free software, you can run a web server on any computer (Windows, Mac or Linux). The software you will need is:

  • XAMPP, which installs:
    • MySQL (SQL Databse Platform)
    • phpMyAdmin (SQL Database Manager)
    • Apache (Web Server)
    • You can also use XAMPP to install a tomcat server (whatever that is) or a FileZilla FTP server, or mail server
  • OPTIONAL: Bitnami for XAMPP (WordPress)
    • WordPress is a powerful blog-building platform that can also be used to build normal websites if used in the right way. I will not be covering how to use WordPress, as everyone’s needs are different. With WordPress, you let WordPress take care of the design and layout of the website and you worry about putting awesome content up. You can also use WordPress’ built-in user database, which automatically encrypts user’s passwords. So, you can build a user-driven application using WordPress’ built-in database instead of learning about cookies, sessions and other complex things necessary to set up a user registration and login system correctly and securely.

 

Here are step-by-step instructions to install XAMPP:

  1. Go here and download the XAMPP with the latest PHP version for your operating system.
  2. For Windows: It gives you a warning about UAC (User Account Control) if you are running it on a computer on which you are an administrator, then install it to C:\xampp. If you are a standard user, then you can install it to a user folder (My Documents, etc.).
  3. The options you need to install for a web server, PHP and Perl are shown in the picture below. All the other options are optional for most purposes.
  4. Uncheck “Learn more about Bitnami for XAMPP” unless, of course, you are interested in learning what plugins Bitnami offers for XAMPP.
  5. Click next for installation, and you are done after that!
  6. Now, we are going to make a few changes in order to make XAMPP as easy and secure to use as possible.

Make XAMPP Server accessible from any computer on the local network:

  1. Open the XAMPP Control Panel and click on Config next to Apache.
  2. Then, click on httpd-xampp.conf
  3. Scroll all the way to the bottom of the file, and change “Require local” to “Allow from all”.
  4. Start the Apache component of XAMPP. If you are on the same computer that is running XAMPP, open a web browser and type in “localhost”. If you are on a different computer, get the IP address or the network name of the computer with XAMPP on it. Then, open a web browser and type in that IP address or network name.
  5. Now, when you are on the XAMPP homepage, click on the Security tab on the left.
  6. If you are on the computer running XAMPP (you typed in localhost to get to this page), click on the link that says [allowed only from localhost]. Otherwise, copy that link, paste it into the address bar of your browser, and replace localhost with the XAMPP server’s IP address or network name.
  7. Set a username and password for access to the XAMPP pages (in the XAMPP DIRECTORY PROTECTION (.htaccess) section).
  8. Click on “Make safe the XAMPP directory”. It should now say “success”, and tell you how it succeeded in password protecting the pages. Refresh the page, enter the credentials you set in step 7, and change the password for the MySQL root. If you are taken away from the security page, navigate back to it using steps 4-6.
  9. Make sure cookie is selected for “phpMyAdmin authentication, and then click on Password changing.
  10. It will ask you to restart MySQL. We haven’t started it yet, so go into the XAMPP Control Panel and start the MySQL component.
  11. Once that is done, in your web browser type in the IP address, network name or localhost (as you did before) and then type “/phpmyadmin” after it (eg: “localhost/phpmyadmin”).
  12. Enter “root” for username and the password you set up earlier.
  13. You are now in phpMyAdmin, the database manager. Here, you can insert data into existing databases, create new databases and tables, and manage anything related to your MySQL database.

SOME INFO ABOUT USING PHPMYADMIN

  • PhpMyAdmin is software for managing MySQL servers. I would recommend a few things before diving in.
  1. Familiarize yourself with SQL. There are many good websites online that help you learn SQL. It is a very simple language with very few keywords that you need to learn. You can use phpMyAdmin without it, but to do cool things with it in PHP and other things you need to know SQL.
  2. Do not touch any of the existing database that XAMPP and phpMyAdmin have created. I would leave those untouched, since they are system-generated and managed. To create your own database, go to the Databases tab and create databases at the top of the page. The basic structure for a database is: Database table(s) column(s) data. This structure can be related to an Excel workbook. The workbook is your database, the sheets are your tables, the top row are your columns and the data is placed in cells below it.
  3. There are many good YouTube and written tutorials on how to use these tools effectively. I would watch and read those to find out more about how to use these powerful tools in the correct ways.

 

  1. Log out when you are done. You have just set up your own web server! Go get yourself something nice.