This document provides information about MySQL databases. Topics include creating databases, removing databases, adding users to a database, changing database passwords, and setting up your database with scripts. DirectAdmin makes database management easy for those people who don’t have in-depth knowledge of databases.
From the main User menu, navigate to Account Manager → select the “MySQL Management” link. You will see a page that looks like this:
Click on Create New Database.
Choose a Database Name that helps you remember what the database is for. For example, enter “blog” if the database is intended to be used with a blog script. The database name is always preceded by your username and an underscore. If you chose “blog” for a name, the actual database name would be testuser_blog.
The Database Username is the login name for the database. It may be the same as the Database Name. In the above example, we choose a different login name (bruce). As with the Database Name, the Database Username is also preceded by your username and an underscore (testuser_bruce in this case).
Choose a Password or generate one. With Random the system will generate that for you.
When you´re done. click Create Database.
It looks like this:
The control panel will then return a messagebox Save the Database information somewhere on your computer, you´ll need it to access the Database from your webapplication or phpMyAdmin.
To delete a database, checkmark it next to the Database. Here you can also Download, Check, Repair or Optomize that database.
In this example, we are deleting the database named testuser_blog.
Adding Users to a Database
There may be times when you want to have more than one login name and password assigned to a database. To add additional users to a database, follow these steps:
1. From the main database menu, click on the name of the database you want to modify.
2. Click on the “Create New User” button.
3. Enter a username and password and then click the “Create” button.
From this page you can also set Access Hosts to the database and delete Users or Hosts.
Setting up your Database with Scripts
Most scripts need to know four things about your database: the database name, database username, password, and hostname.
The database name always takes the form as ControlPanelUsername_DatabaseName, where ControlPanelUsername is the sign in name you use to access the control panel. The DatabaseName is the name you give to the database from the MySQL databases menu. For example, if you sign into the control panel as “testuser” and create a database named “blog,” the true database name is testuser_blog — you will want to enter this database name into your script configuration.
The database username can be the same as the database name or you may choose a different username for the database. The database username takes the form of ControlPanelUsername_DatabaseUserName.
The database password is set during database creation. The password should be different than your control panel password. The script will need to know the database password in order to modify the database.
The hostname tells the script where to access the database. Usually this is designated as ‘localhost’ because the script and database are located on the same server. If the script doesn’t allow a text entry in the hostname configuration, enter the IP address of your site.
Note: After you create a database, the control panel will take you to a screen that gives you all this information. Simply take the values from this page and enter them into your script configuration.
phpMyAdmin is a tool written in PHP that allows you to administrate your MySQL databases. You can execute SQL statements, work with fields (add, edit, delete), work with tables (create, alter, drop), create additional databases, and much more. phpMyAdmin is intended for advanced users. Most PHP scripts will automatically setup the database for you, so you probably won’t need to use phpMyAdmin.
phpMyAdmin can be accessed at http://www.yourdomain.com/phpMyAdmin or from the main User menu, navigate to Extra Features → select the “phpMyAdmin” link. Authentication is required, you need to login with your (database) Username and Password.
Please visit https://www.phpmyadmin.net for more information on using phpMyAdmin.
Need more help?
Please contact your hosting company for more assistance, or visit the DirectAdmin support forum at https://forum.directadmin.com/.