This topic will show how to setup and manage MySQL/MariaDB databases & users.
What is MySQL?
MySQL is an available open source Relational Database Management System (RDBMS) that uses SQL (Structured Query Language).
Why is SQL popular? MySQL is one of the easiest languages for adding, accessing and managing content in a database. It is known for its quick query processing, reliability, and easy management. A lot of popular software used by a majority of the internet uses MySQL / MariaDB databases including WordPress (Most blog sites use WordPress), Joomla, osCommerce, phpBB, etc.
What is MariaDB?
MariaDB is a fork of the MySQL database engine. It is developed on by many developers including some of the original MySQL creators of the MySQL Database Engine. It is also a free open-source project available to the public. This is the engine that is used on all of our newer shared database servers for MySQL/MariaDB.
Login to your WCP control panel.
Note: You can view our topic on logging into WCP if you need help with this step.
Once logged in if you are not already on the domain in questions control panel page then click on the ‘Hosted Domains’ drop-down from the top of the pages navigation bar. Then select the desired domain from the drop-down.
Once logged into the control panel for the domain you wish to use click on the ‘MySQL’ icon under the ‘Databases’ section.
If you don’t have any existing databases then skip to step 5, as you’ll automatically be on the ‘new database’ screen.
If you do already have existing database(s) then you should see them listed here, along with the server they reside on. Click on the ‘Add Database’ button to create a new database.
You will now be asked for the below database information to be created:
Server: This ‘Server’ field will show the server that your MySQL database will be created on, along with the version of MySQL / MariaDB that the server is using.
Database Name: Enter the desired database name that you wish to create.
User: This ‘User’ drop-down allows you to select an already existing user if you have a MySQL user that is already on the server that your new database is being created on. If you do not have a pre-existing user or you don’t wish to use a pre-existing user then you’ll need to fill in the username and password fields.
Username: Enter the username you wish to create that you’ll use to login to the MySQL database.
Password: Enter the password for the new MySQL user that you are creating. You’ll use this password to login to the MySQL database user.
When selecting the ‘ColdFusion DataSource’ checkbox a field will appear for the ‘DataSource Name’.
A data source is a saved configuration of database connection information including the Database Name, Username, Password, Port, Server, ect. This is used so you do not have to specify the connection information within your sites code and can instead just reference the singular data source name.
Note: This feature is only viewable if your site resides on a ColdFusion server.
Note: When selecting this option the database information you create on this page will be stored with the given DataSource Name you provide.
- Double check the values you have entered, then click the ‘Save’ button to add this MySQL database.
![image](https://img.hostek.net/tutorials/wcp/databases/mysql.png "Click the 'MySQL' icon")
If you have databases that reside on multiple database servers, you may need to click on the pencil icon next to the related MySQL database server (you should see a list of databases on each database server in order to differentiate).
As shown in the below screenshot we have a database on our MySQL19 server and we have a database on our MySQL20 server, so we would need to click the pencil icon next to the server we wish to manage the users for.
![image](https://img.hostek.net/tutorials/wcp/databases/add_mysql_user.png "Click the 'Add User' button")
You should now see the below requested fields for the new MySQL user:
Username: Enter the name of the new MySQL user you would like to add.
Password: Enter the password for the new MySQL user you would like to add.
Permissions: The ‘Permissions’ section allows you to choose which databases the MySQL user has access to, as well as to what type of permissions it will have access to for that database… for example you can enable the user to ONLY have ‘Select’ permissions so that the user can only view existing data in the database but not actually update, add, or delete any new content within the database.
Double check the values you have entered, then click the ‘Save’ button to add this MySQL database user and it’s respective permissions.
Click on the pencil icon next to the MySQL user you wish to edit.
Now you will be able to update the MySQL users password and / or permissions.
Double check the values you have entered, then click the ‘Save’ button to save any changes you’ve made to the MySQL user.
- Click the trash can icon next to the user you wish to delete.
- You should receive a prompt asking if you are sure you wish to delete the selected user. Click ‘OK’ to delete, or ‘Cancel’ to cancel the deletion of the MySQL user.