Site Cloner PHP Script
Bargain Hunter PHP Script
Job Hunter PHP Script
Site Login and Access Control PHP Script

Setup mySQL Database

If you want to use the command line to setup a mySQL database without any fuss, you have landed on the right page.


Setup Database With Existing User

The next set of mySQL commands do several things. The first line is used to gain access to mySQL using the root user and password. That command is made in Linux. One authentication is approved, a database is created within the mySQL console. After that, all privileges are granted to the user my_username@localhost.

After that, the the grant tables are reloaded using teh ‘FLUSH PRIVILEGES’ command. Finally, the exit command is used to get back to the Linux command line.

 root# mysql -u root -p  Enter password:  
mysql> CREATE DATABASE my_database;  
mysql> USE my_database; 
mysql> GRANT ALL PRIVILEGES ON my_database.* TO 'my_username'@'localhost'  
mysql> FLUSH PRIVILEGES;  
mysql> exit

Setup Database and User

These instructions are the same as the example above, except that a user is created. It contains only one extra command with the mySQL console.

 root# mysql -u root -p  Enter password:  
mysql> CREATE DATABASE my_database;  
mysql> USE my_database; 
mysql> CREATE USER 'my_username'@'localhost' IDENTIFIED BY 'my_password';  
mysql> GRANT ALL PRIVILEGES ON my_database.* TO 'my_username'@'localhost'  
mysql> FLUSH PRIVILEGES;  
mysql> exit

Once the database is setup, you can use the mySQL console or phpMyAdmin to create, update and delete databases. With phpMyAdmin, you can import sql files to load up the database.

You can also run Linux commands to dump data into it. Here is a page to reference how to dump data with Linux.