1 | Firstly, you will need to log in to your server via SSH or Telnet as the root user, or some other user with permission to control MySQL at the root level. Windows users can use Command Prompt. |
2 | Next, you will need to start the MySQL command line tool by typing something along these lines:/usr/local/mysql/bin/mysql -uroot -pon Windows it willl be similar to: c:\mysql\bin\mysql -uroot -pThe system will then ask you to provide the MySQL root password to continue. |
3 | When you have completed the login to MySQL you will see a mysql> command prompt. To see the list of databases that already exist, type the following:SHOW DATABASES;You will then be given a list of the databases that already exist. The name you choose for your new database must be unique, so ensure that the name you want to give to your new database is not already in use. |
4 | After you have decided upon a name, you can run the query to create the new database. For this example, we will call the database example_database. Type the following, replacing the name of the database with the name you have chosen: CREATE DATABASE example_database; |
5 | Having created the database, we will now create a MySQL user account with permission to access the new database. Doing this is a security precaution, as it's never a good idea to have PHP scripts talking to MySQL with root privileges. In this example, we will name our new user example_user and give the account a password of p4ssw0rd. Replace those values as appropriate when you type the following: GRANT ALL ON example_database.* |
$config['Database']['dbname'] = 'example_database';
$config['MasterServer']['servername'] = 'localhost';
$config['MasterServer']['username'] = 'example_user';
$config['MasterServer']['password'] = 'p4ssw0rd';