To begin you will need to click on the MySQL Database link when you log into your Control Panel.
Enter a name for your database where it says Db: . In the below example, the name of the database is testdb.
After clicking Add Db. The database will be created. Your account's username will be appended to the beginning of the database name you created. This will be the new database name. In this example, the account's username was amsnac2. The name of the database will then be amsnac2_testdb.
Here you can see that the database was created, and the name of the database is amsnac2_testdb. We will now need to create a user that has access to this database.
Below the section that says Users, you will see two text boxes. One for username and one for password. Enter a desired username and a desired password. In this example, I will enter a username of testuser and a password of test.
The username will again get the account's username appended to the
beginning of it. So the actual username to use in a script would be amsnac2
_testuser
You will notice that the drop down boxes under Users in amsnac2_testdb have changed. There is now a user listed beside User. You will need to select a username and the corresponding database you want this user to have access to. Since there is only one database and one username created for this example, they are selected by default. Clicking on Add User to Db will add this user to the database.
The database has been created and a user has been assigned to the database. To recap here is the information you would use to access the database in this example:
Database Name: | amsnac2_testdb |
Username: | amsnac2_testuser |
Password: | test |
If you are running a script on the server that requires a MySQL database, the server or servername to use, is likely localhost. This is assuming that the script resides on the server and is accessing the MySQL server that is on the same server.
You can create additional usernames to access the same database. Each user will need to be added to the database, however. The username of the account is appeneded to the database name and username, to prevent overlapping, in case another user creates the same database name or same username.
As always, if you have any additional questions or comments, feel free to contact us using this form.