Follow this procedure to create a MySQL database for your new website

Create a new database

You create a new database using the mysqladmin command. In the above example, we use the domain name as the databasename. Be aware that you can’t use the domain name with dots – replace it with underscores instead.

Connect to the MySQL database using the command line client

Using the mysql command line client, you connect to the MySQL database to set up the access rights to the newly created database. Note: It’s not an error with the double "mysql mysql" above – the first mysql is the call to the mysql client and the next mysql is the name of the database we want to connect to. The database named mysql contains all the user information.

Grant full access to the database

With a simple grant SQL statement, you define the rights for the user "exampleuser." Replace the username with the one you wish to use. The password in the example above, was created with the random password generator called "pwgen."

Later on, you use the user and password to let your application access the database.

To quit the mysql client, type "\q" and press "Enter".

Skriv et svar