{"id":138470,"date":"2015-03-29T08:00:17","date_gmt":"2015-03-29T12:00:17","guid":{"rendered":"http:\/\/premium.wpmudev.org\/blog\/?p=138470"},"modified":"2022-03-02T04:06:41","modified_gmt":"2022-03-02T04:06:41","slug":"change-database-name","status":"publish","type":"post","link":"https:\/\/wpmudev.com\/blog\/change-database-name\/","title":{"rendered":"Change Your WordPress Database Name in 3 Simple Steps"},"content":{"rendered":"<p>Your WordPress database holds all of your site&#8217;s important information, so keeping it safe and organized isn&#8217;t something that should be neglected.<\/p>\n<p>Naming your database in a descriptive way can help you more easily keep track of your site and help prevent you from making unintended changes when you can&#8217;t\u00a0tell your databases apart. It also helps protect your site by making it more difficult for hackers to identify and access your database details.<\/p>\n<p>It&#8217;s easy to change your database from a default name like db_wordpress123 to db_mysite and it can be done in about five minutes. In this post, I&#8217;ll show you how to change the end of your database name to something more recognizable to you, while also being less guessable for hackers.<\/p>\n<ul>\n<li><a href=\"#database\">Edit Your Database<\/a><\/li>\n<li><a href=\"#config\">Edit Your wp-config.php File<\/a><\/li>\n<li><a href=\"#user\">Assign a Database User<\/a><\/li>\n<li><a href=\"#conclusion\">Conclusion<\/a><\/li>\n<\/ul>\n<h2 id=\"database\">Edit Your Database<\/h2>\n<p>Head over to phpMyAdmin. In cPanel, you can access it through the <strong>Databases<\/strong> section of the home page. Once there, select your database from the menu on the left, then click the <strong>Operations<\/strong> tab at the top.<\/p>\n<div  class=\"wpdui-pic-regular  \">\n<div class=\"image-grid cgrid-row\">\n<div class=\"cgrid-col cgrid-col-span-full\">\n<figure id=\"attachment_138918\" class=\"wp-caption aligncenter\" data-caption=\"true\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-138918 size-full\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2015\/03\/change-database-name.png\" alt=\"The operations tab has been clicked in phpMyAdmin after a database has been selected.\" width=\"735\" height=\"210\" \/><figcaption class=\"wp-caption-text\">You can rename your database to whatever you would like as long as you only include letters and numbers.<\/figcaption><\/figure>\n<\/div>\n<\/div>\n<\/div>\n<p>Under <strong>Rename database to<\/strong>, enter the name you would like to see for your database in the text field and click <strong>Go<\/strong> on the bottom, right corner of field. You will be prompted with a pop-up to accept the change.<\/p>\n<p>You will be creating a new database with your chosen name, dropping the tables in your original, then importing those tables to your new database. Click <strong>OK<\/strong> to continue with these changes.<\/p>\n<h2 id=\"config\">Edit Your <em>wp-config.php<\/em> File<\/h2>\n<p>Navigate to your site&#8217;s files and in the root of your WordPress install, locate your <em>wp-config.php<\/em> file. In cPanel, edit the file by selecting it from the list and clicking the <strong>Edit<\/strong> button at the top of the page. If a pop-up appears, click <strong>Edit<\/strong> again.<\/p>\n<p>You can also choose to download the file through FTP and edit it with a text editor. Either way, include your new database name by finding the piece of code similar to the one below:<\/p>\n<p><span style=\"font-weight: 400;\"><div class=\"gist\" data-gist=\"5cffa6a3a80841644bb6577b3f8b1226\" data-gist-file=\"wp-config\"><a class=\"loading\" href=\"https:\/\/gist.github.com\/5cffa6a3a80841644bb6577b3f8b1226.js?file=wp-config\">Loading gist 5cffa6a3a80841644bb6577b3f8b1226<\/a><div class=\"gist-consent-notice\" style=\"display:none\"><p>Please <a href=\"javascript:Cookiebot.renew()\">update your cookie preferences<\/a> to enable preference cookies to view this gist.<\/p><\/div><\/div><\/span><\/p>\n<p>Find <code>define('DB_NAME', 'your_db');<\/code> in your file, where <code>your_db<\/code> is the original name of your database and change it to the new name you chose a moment ago.<\/p>\n<p>Save the file and if you&#8217;re using FTP, upload the new file to the root of your install.<\/p>\n<h2 id=\"user\">Assign a Database User<\/h2>\n<p>In cPanel, click on <strong>MySQL Databases<\/strong> under the <strong>Databases<\/strong> section. Scroll down to the <strong>Add a User to a Database<\/strong>\u00a0area and select your username from the User drop down box.<\/p>\n<p>If you&#8217;re not sure what it is, it&#8217;s listed in your wp-config.php file on the line with <code>DB_USER<\/code> just like in the example above.<\/p>\n<p>Next, select your new database name from the <strong>Database<\/strong> drop down box and finally, click the <strong>Add<\/strong> button. On the page that loads, select the <strong>All Privileges<\/strong> checkbox toward the top, then click the <strong>Make Changes<\/strong> button below the table.<\/p>\n<div  class=\"wpdui-pic-regular  \">\n<div class=\"image-grid cgrid-row\">\n<div class=\"cgrid-col cgrid-col-span-full\">\n<figure id=\"attachment_138921\" class=\"wp-caption aligncenter\" data-caption=\"true\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-138921 size-full\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2015\/03\/database-user-privileges.png\" alt=\"The &quot;All Privileges&quot; checkbox has been selected and the &quot;Make Changes&quot; button is highlighted.\" width=\"735\" height=\"365\" \/><figcaption class=\"wp-caption-text\">Make sure all the boxes are checked unless you are adding additional users to the database and would like them to have different permissions.<\/figcaption><\/figure>\n<\/div>\n<\/div>\n<\/div>\n<p>Reactivate all your plugins and you&#8217;re done!<\/p>\n<h2 id=\"conclusion\">Conclusion<\/h2>\n<p>Go ahead and visit your site. It should be up and running with your new database name. Now you&#8217;ll be a bit more organized and safer.<\/p>\n<p>If you&#8217;re interested in making more customizations to your database, check out our post\u00a0<a href=\"https:\/\/wpmudev.com\/blog\/creating-database-tables-for-plugins\/\" target=\"_blank\">Creating Custom Database Tables for Your WordPress Plugins<\/a>.<\/p>\n<p>If you&#8217;d like more ways to secure your site, check out our posts\u00a0<a href=\"https:\/\/wpmudev.com\/blog\/wordpress-security-essentials-say-goodbye-to-hackers\/\" target=\"_blank\">WordPress Security Essentials: Say Goodbye to Hackers<\/a>,\u00a0<a href=\"https:\/\/wpmudev.com\/blog\/wordpress-security-essentials-four-points-of-vulnerability\/\" target=\"_blank\">WordPress Security Essentials : Four Points Of Vulnerability<\/a> and\u00a0<a href=\"https:\/\/wpmudev.com\/blog\/wordpress-security-obscurity-tactics-and-backups\/\" target=\"_blank\">WordPress Security Essentials: Obscurity Tactics and Backups<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Your WordPress database holds all of your site&#8217;s important information, so keeping it safe and organized isn&#8217;t something that should be neglected. Naming your database in a descriptive way can help you more easily keep track of your site and help prevent you from making unintended changes when you can&#8217;t tell your databases apart.<\/p>\n","protected":false},"author":54213,"featured_media":199251,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"blog_reading_time":"","wds_primary_category":0,"wds_primary_tutorials_categories":0,"footnotes":""},"categories":[1117,263],"tags":[10810,1004,9798],"tutorials_categories":[],"class_list":["post-138470","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-multisite","category-tutorials","tag-wordpress-security","tag-database","tag-weekend-wordpress-projects"],"_links":{"self":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts\/138470","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/users\/54213"}],"replies":[{"embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/comments?post=138470"}],"version-history":[{"count":10,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts\/138470\/revisions"}],"predecessor-version":[{"id":205970,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts\/138470\/revisions\/205970"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/media\/199251"}],"wp:attachment":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/media?parent=138470"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/categories?post=138470"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/tags?post=138470"},{"taxonomy":"tutorials_categories","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/tutorials_categories?post=138470"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}