{"id":1401,"date":"2011-10-05T20:27:34","date_gmt":"2011-10-05T12:27:34","guid":{"rendered":"https:\/\/webhostinggeeks.com\/howto\/?p=1401"},"modified":"2023-04-28T09:50:01","modified_gmt":"2023-04-28T09:50:01","slug":"how-to-fix-mysql-database-error-cant-create-database-newdbname-errno-28","status":"publish","type":"post","link":"https:\/\/webhostinggeeks.com\/howto\/how-to-fix-mysql-database-error-cant-create-database-newdbname-errno-28\/","title":{"rendered":"How to Fix MySQL Database Error: Can&#8217;t create database &#8216;newdbname&#8217; (errno: 28)"},"content":{"rendered":"<p>The MySQL error &#8220;Can&#8217;t create database &#8216;newdbname&#8217; (errno: 28)&#8221; usually occurs when there is insufficient disk space on your server or partition where the MySQL data directory resides.<\/p>\n<pre class=\"code\">\r\nmysql> CREATE DATABASE newdbname;\r\nERROR 1006 (HY000): Can't create database 'newdbname' (errno: 28)\r\n<\/pre>\n<p>This guide will show you how to troubleshoot and fix this issue.<\/p>\n<h2>Step 1: Check available disk space<\/h2>\n<p>First, verify the available disk space on your server by running the following command:<\/p>\n<pre>\r\ndf -h\r\n<\/pre>\n<p>This command will display the disk usage and free space for all mounted partitions. Pay attention to the partition where your MySQL data directory is located (usually \/var\/lib\/mysql).<\/p>\n<h2>Step 2: Free up disk space<\/h2>\n<p>If there is indeed insufficient space on the partition, consider taking the following actions to free up some disk space:<\/p>\n<ol>\n<li>Delete unnecessary files and directories.<\/li>\n<li>Remove or archive old logs.<\/li>\n<li>Clear cache or temporary files.<\/li>\n<li>Uninstall unused software packages.<\/li>\n<li>Move non-critical data to another partition or an external storage device.<\/li>\n<\/ol>\n<h2>Step 3: Verify MySQL data directory permissions<\/h2>\n<p>Ensure that the MySQL data directory has the proper permissions and is owned by the MySQL user. To check the permissions and ownership, run:<\/p>\n<pre>\r\nls -ld \/var\/lib\/mysql\r\n<\/pre>\n<p>The output should show the MySQL user and group ownership (usually &#8216;mysql&#8217;) and the correct permissions (usually drwxr-xr-x). If you need to change the ownership, use the chown command:<\/p>\n<pre>\r\nsudo chown -R mysql:mysql \/var\/lib\/mysql\r\n<\/pre>\n<h2>Step 4: Restart MySQL service<\/h2>\n<p>After freeing up disk space and ensuring correct permissions, restart the MySQL service:<\/p>\n<pre>\r\nsudo service mysql restart\r\n<\/pre>\n<p>Now, try creating the database again.<\/p>\n<pre class=\"code\">\r\nmysql> CREATE DATABASE newdbname;\r\nQuery OK, 1 row affected (0.00 sec)\r\n<\/pre>\n<h2>Programs Mentioned:<\/h2>\n<ul>\n<li><span class=\"fw-bold\">MySQL<\/span> &#8211; An open-source relational database management system used for managing databases and organizing data.<\/li>\n<\/ul>\n<h2>Conclusion<\/h2>\n<p>By following this guide, you should have successfully resolved the MySQL error &#8220;Can&#8217;t create database &#8216;newdbname&#8217; (errno: 28)&#8221; by checking available disk space, freeing up disk space, and ensuring the correct permissions for the MySQL data directory. Always monitor your server&#8217;s disk usage and perform regular maintenance to avoid running into similar issues in the future.<\/p>\n<p>If you have any questions, comments, or suggestions for improvements, please feel free to share your thoughts. Your feedback helps us provide the most accurate and useful information possible.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The MySQL error &#8220;Can&#8217;t create database &#8216;newdbname&#8217; (errno: 28)&#8221; usually occurs when there is insufficient disk space on your server or partition where the MySQL data directory resides. mysql> CREATE&#8230;<\/p>\n","protected":false},"author":6,"featured_media":343,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"wds_primary_category":0,"footnotes":""},"categories":[1008],"tags":[1536,1585],"class_list":["post-1401","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-mysql","tag-linux","tag-mysql"],"_links":{"self":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/1401","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/comments?post=1401"}],"version-history":[{"count":0,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/1401\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media\/343"}],"wp:attachment":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media?parent=1401"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/categories?post=1401"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/tags?post=1401"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}