Both Joomla and WordPress keep data in MySQL database. That's the reason why you need to create a database on your server prior to installation of Joomla or WordPress. When you are making a new MySQL database, you select its name. What if you, from any reason, decide to rename MySQL database later?
If you are on a shared server, you probably need to create a new database, then make database dump from old database and import it into the new database. However, if you have full access over your MySQL server, you can rename a database much easier.
Log in to your PhpMyAdmin and click the database name you are about to rename. The list of all your databases are in the left column. After that, click the "Operations" tab. In the box "Rename database to:", you can enter new database name. You just need to click "Go" button and PhpMyAdmin will do the rest of the job. It will automatically drop the existing database, create a new database with new name and insert all content from the old database into the new database.
You Joomla or WordPress site will not be operational until you edit configuration file. This file contains name of the database which was selected during initial installation. To change it for Joomla, using Notepad or any other plain text editor, open file <Joomla Root>/configuration.php. Find line that looks like:
public $db = 'joomla321';
The value which is 'joomla321' in our case, should be changed to reflect new database name, in example to 'newbase'.
If you have site based on WordPress, configuration file is in &WordPress Root>/wp-config.php. Edit this file in Notepad (or any other plain text editor) and find line:
The value for DB_NAME should be changed. In our case, it's 'wp_cars', so just change it to reflect new database name, in example 'newbase'.