{"id":162,"date":"2026-05-28T23:12:26","date_gmt":"2026-05-29T06:12:26","guid":{"rendered":"https:\/\/hostandtech.com\/kb\/mysql\/how-to-create-mysql-database-and-user\/"},"modified":"2026-05-28T23:12:26","modified_gmt":"2026-05-29T06:12:26","slug":"how-to-create-mysql-database-and-user","status":"publish","type":"post","link":"https:\/\/hostandtech.com\/kb\/mysql\/how-to-create-mysql-database-and-user\/","title":{"rendered":"How to Create a MySQL Database and User (cPanel, Plesk &amp; CLI)"},"content":{"rendered":"<h2>Overview<\/h2>\n<p>Every web application that stores data needs a MySQL database \u2014 WordPress, Joomla, Magento, Laravel apps, custom PHP projects, all of them. Before any installation wizard can run, you need to create the MySQL database itself, create a user, and grant that user access to the database. If you skip any of those three steps, your app will throw a connection error before it even loads.<\/p>\n<p>On shared hosting and managed WordPress plans, this is typically done through a control panel like cPanel or Plesk. On a VPS or dedicated server where you have root access, you&#8217;ll do it directly from the command line. This guide covers all three paths. The SQL commands are the same regardless of which MySQL or MariaDB version you&#8217;re running (5.7, 8.0, 10.x MariaDB), but I&#8217;ll call out version-specific differences where they matter.<\/p>\n<p>If you&#8217;re on one of our <a href=\"https:\/\/www.hostandtech.com\/vps-ssd-servers\">VPS SSD Hosting<\/a> plans and have root SSH access, skip straight to the CLI section \u2014 that&#8217;s the fastest route and gives you the most control.<\/p>\n<h2>Prerequisites<\/h2>\n<ul>\n<li>Active hosting account with cPanel, Plesk, or SSH root\/sudo access to a VPS or dedicated server<\/li>\n<li>MySQL or MariaDB installed and running (any version from 5.7 onward)<\/li>\n<li>For cPanel: your cPanel login credentials<\/li>\n<li>For Plesk: your Plesk admin or domain owner credentials<\/li>\n<li>For CLI: SSH access and either root or a sudo-enabled user<\/li>\n<li>A name in mind for your database and user \u2014 most control panels enforce a prefix (e.g. <code class=\"\" data-line=\"\">cpanelusername_dbname<\/code>), so plan accordingly<\/li>\n<\/ul>\n<h2>Method 1: Create a MySQL Database and User in cPanel<\/h2>\n<p>cPanel&#8217;s MySQL Database Wizard is the simplest option for non-technical users. It walks you through database creation, user creation, and permissions in a single flow.<\/p>\n<ol>\n<li>\n    <strong>Log in to cPanel<\/strong> and navigate to the <strong>Databases<\/strong> section. Click <strong>MySQL Database Wizard<\/strong>.\n  <\/li>\n<li>\n    <strong>Create the database.<\/strong> Enter a name in the <em>New Database<\/em> field. cPanel automatically prepends your cPanel username \u2014 so if your account is <code class=\"\" data-line=\"\">mysite<\/code> and you type <code class=\"\" data-line=\"\">wordpress<\/code>, the database will be named <code class=\"\" data-line=\"\">mysite_wordpress<\/code>. That full name is what you&#8217;ll use in your app&#8217;s config. Click <strong>Next Step<\/strong>.\n  <\/li>\n<li>\n    <strong>Create the database user.<\/strong> Enter a username and a strong password. Same prefix rule applies \u2014 the user will be <code class=\"\" data-line=\"\">mysite_wpuser<\/code> or similar. Use the password generator if you&#8217;re not sure what qualifies as strong enough; cPanel will tell you if it&#8217;s too weak.<\/p>\n<p>\ud83d\udcdd Note: Write down the exact database name, username, and password before you proceed. You&#8217;ll need all three when configuring your app.<\/p>\n<\/li>\n<li>\n    <strong>Assign privileges.<\/strong> On the next screen, check <strong>ALL PRIVILEGES<\/strong> unless you have a specific reason to restrict access. For most web apps, all privileges on a single named database is the correct and expected setup. Click <strong>Next Step<\/strong>.\n  <\/li>\n<li>\n    Done. cPanel confirms the user has been added to the database. You can verify under <strong>Databases &gt; MySQL Databases<\/strong> \u2014 your new database should appear in the list with the user shown underneath it.\n  <\/li>\n<\/ol>\n<p>\u26a0 Warning: cPanel&#8217;s <strong>MySQL Databases<\/strong> page (not the Wizard) lets you create databases and users separately. If you use that route, it&#8217;s easy to forget the final step \u2014 actually assigning the user to the database. A user that exists but isn&#8217;t linked to the database will get <code class=\"\" data-line=\"\">Access denied<\/code> every time. Always scroll down to the <em>Add User To Database<\/em> section and complete that step.<\/p>\n<h2>Method 2: Create a MySQL Database and User in Plesk<\/h2>\n<ol>\n<li>Log in to Plesk and go to <strong>Websites &amp; Domains<\/strong>. Select the domain you&#8217;re working with.<\/li>\n<li>Click <strong>Databases<\/strong>, then click <strong>Add Database<\/strong>.<\/li>\n<li>Enter a database name. Under <em>Related site<\/em>, confirm the correct domain is selected.<\/li>\n<li>Under <em>Database user name<\/em>, enter a username and password. Plesk creates the user and links it to the database in the same step \u2014 one less thing to forget.<\/li>\n<li>Click <strong>OK<\/strong>. The database will appear in the list immediately.<\/li>\n<\/ol>\n<p>\ud83d\udcdd Note: Plesk Obsidian (18.x) and later show a <strong>phpMyAdmin<\/strong> shortcut next to each database. You can use that to verify the database was created and import an SQL dump if you&#8217;re migrating from another host.<\/p>\n<h2>Method 3: Create a MySQL Database and User via CLI<\/h2>\n<p>This is the method you&#8217;ll use on a VPS or dedicated server with direct shell access. It&#8217;s faster than any control panel once you&#8217;re comfortable with it, and it&#8217;s the only option when there&#8217;s no panel installed.<\/p>\n<h3>Step 1: Log in to MySQL<\/h3>\n<p>On most systems you can log in as root like this:<\/p>\n<div class=\"ht-code-snippet\"><button class=\"ht-code-snippet__copy\" type=\"button\" aria-label=\"Copy code\"><\/button><span class=\"ht-code-snippet__feedback\">Copied to clipboard<\/span><\/p>\n<pre class=\"ht-code-snippet__code\" id=\"code-block-1\"><code class=\"\" data-line=\"\">sudo mysql -u root -p<\/code><\/pre>\n<\/div>\n<p>On Ubuntu 20.04+ and some other distros, MySQL\/MariaDB installs with socket-based authentication for the root user by default. This means the command above may drop you straight in without asking for a password \u2014 or it may fail if you try to log in with a password that was never set. If you hit <code class=\"\" data-line=\"\">Access denied<\/code> running <code class=\"\" data-line=\"\">mysql_secure_installation<\/code> or any other tool, this is usually why. Fix it like this:<\/p>\n<div class=\"ht-code-snippet\"><button class=\"ht-code-snippet__copy\" type=\"button\" aria-label=\"Copy code\"><\/button><span class=\"ht-code-snippet__feedback\">Copied to clipboard<\/span><\/p>\n<pre class=\"ht-code-snippet__code\" id=\"code-block-2\"><code class=\"\" data-line=\"\">sudo mysql\n<\/code><\/pre>\n<\/div>\n<div class=\"ht-code-snippet\"><button class=\"ht-code-snippet__copy\" type=\"button\" aria-label=\"Copy code\"><\/button><span class=\"ht-code-snippet__feedback\">Copied to clipboard<\/span><\/p>\n<pre class=\"ht-code-snippet__code\" id=\"code-block-3\"><code class=\"\" data-line=\"\">ALTER USER &#039;root&#039;@&#039;localhost&#039; IDENTIFIED WITH mysql_native_password BY &#039;YourNewRootPassword&#039;;\nFLUSH PRIVILEGES;\nEXIT;\n<\/code><\/pre>\n<\/div>\n<p>Then rerun <code class=\"\" data-line=\"\">mysql_secure_installation<\/code> or log in normally with <code class=\"\" data-line=\"\">mysql -u root -p<\/code>. Replace <code class=\"\" data-line=\"\">YourNewRootPassword<\/code> with an actual strong password \u2014 never leave example passwords in a production system.<\/p>\n<h3>Step 2: Create the Database, User, and Grant Permissions<\/h3>\n<p>Once you&#8217;re at the MySQL prompt, run the following block. Replace <code class=\"\" data-line=\"\">myappdb<\/code>, <code class=\"\" data-line=\"\">myappuser<\/code>, and <code class=\"\" data-line=\"\">StrongPassword123!<\/code> with your own values before running anything.<\/p>\n<div class=\"ht-code-snippet\"><button class=\"ht-code-snippet__copy\" type=\"button\" aria-label=\"Copy code\"><\/button><span class=\"ht-code-snippet__feedback\">Copied to clipboard<\/span><\/p>\n<pre class=\"ht-code-snippet__code\" id=\"code-block-4\"><code class=\"\" data-line=\"\">CREATE DATABASE myappdb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;\nCREATE USER &#039;myappuser&#039;@&#039;localhost&#039; IDENTIFIED BY &#039;StrongPassword123!&#039;;\nGRANT ALL PRIVILEGES ON myappdb.* TO &#039;myappuser&#039;@&#039;localhost&#039;;\nFLUSH PRIVILEGES;\n<\/code><\/pre>\n<\/div>\n<p>A quick explanation of what each line does:<\/p>\n<ul>\n<li><code class=\"\" data-line=\"\">CREATE DATABASE<\/code> with <code class=\"\" data-line=\"\">utf8mb4<\/code> \u2014 this charset handles emoji and multilingual characters correctly. The older <code class=\"\" data-line=\"\">utf8<\/code> in MySQL is actually a 3-byte subset and will silently fail on some characters. Always use <code class=\"\" data-line=\"\">utf8mb4<\/code> for new databases.<\/li>\n<li><code class=\"\" data-line=\"\">CREATE USER &#039;myappuser&#039;@&#039;localhost&#039;<\/code> \u2014 the <code class=\"\" data-line=\"\">@&#039;localhost&#039;<\/code> part restricts this user to local connections only. If your app and database are on the same server, this is correct and more secure than <code class=\"\" data-line=\"\">@&#039;%&#039;<\/code>.<\/li>\n<li><code class=\"\" data-line=\"\">GRANT ALL PRIVILEGES ON myappdb.*<\/code> \u2014 this grants full access to every table in <code class=\"\" data-line=\"\">myappdb<\/code> only, not to all databases on the server. This is intentional.<\/li>\n<li><code class=\"\" data-line=\"\">FLUSH PRIVILEGES<\/code> \u2014 this reloads the grant tables so your changes take effect immediately. Some operations don&#8217;t require it in MySQL 8.0+, but running it never hurts and skipping it has caused me confusion before on older MariaDB setups.<\/li>\n<\/ul>\n<h3>Step 3: Verify the Setup<\/h3>\n<div class=\"ht-code-snippet\"><button class=\"ht-code-snippet__copy\" type=\"button\" aria-label=\"Copy code\"><\/button><span class=\"ht-code-snippet__feedback\">Copied to clipboard<\/span><\/p>\n<pre class=\"ht-code-snippet__code\" id=\"code-block-5\"><code class=\"\" data-line=\"\">SHOW DATABASES;\nSHOW GRANTS FOR &#039;myappuser&#039;@&#039;localhost&#039;;\nEXIT;\n<\/code><\/pre>\n<\/div>\n<p>You should see <code class=\"\" data-line=\"\">myappdb<\/code> in the list and a <code class=\"\" data-line=\"\">GRANT ALL PRIVILEGES<\/code> line for your user. If either is missing, recheck your commands for typos \u2014 MySQL won&#8217;t warn you if you accidentally create a database with a mismatched name.<\/p>\n<h3>Optional: Connect Your App<\/h3>\n<p>For a PHP application (like WordPress or a custom app), the database connection details would look like this in a config file:<\/p>\n<div class=\"ht-code-snippet\"><button class=\"ht-code-snippet__copy\" type=\"button\" aria-label=\"Copy code\"><\/button><span class=\"ht-code-snippet__feedback\">Copied to clipboard<\/span><\/p>\n<pre class=\"ht-code-snippet__code\" id=\"code-block-6\"><code class=\"\" data-line=\"\">&lt;?php\ndefine(&#039;DB_NAME&#039;,     &#039;myappdb&#039;);\ndefine(&#039;DB_USER&#039;,     &#039;myappuser&#039;);\ndefine(&#039;DB_PASSWORD&#039;, &#039;StrongPassword123!&#039;);\ndefine(&#039;DB_HOST&#039;,     &#039;localhost&#039;);\n<\/code><\/pre>\n<\/div>\n<p>For a <code class=\"\" data-line=\"\">.env<\/code> file used by Laravel or similar frameworks:<\/p>\n<div class=\"ht-code-snippet\"><button class=\"ht-code-snippet__copy\" type=\"button\" aria-label=\"Copy code\"><\/button><span class=\"ht-code-snippet__feedback\">Copied to clipboard<\/span><\/p>\n<pre class=\"ht-code-snippet__code\" id=\"code-block-7\"><code class=\"\" data-line=\"\">DB_CONNECTION=mysql\nDB_HOST=127.0.0.1\nDB_PORT=3306\nDB_DATABASE=myappdb\nDB_USERNAME=myappuser\nDB_PASSWORD=StrongPassword123!\n<\/code><\/pre>\n<\/div>\n<h2>Common Issues &amp; Troubleshooting<\/h2>\n<h3>ERROR 1045 (28000): Access denied for user &#8216;myappuser&#8217;@&#8217;localhost&#8217;<\/h3>\n<p>This is the most common error after creating a user. Nine times out of ten, either the password in your app config doesn&#8217;t match what you set in MySQL, or the user wasn&#8217;t actually granted access to that specific database. Log back in as root and rerun the <code class=\"\" data-line=\"\">SHOW GRANTS<\/code> command from Step 3 above. If no grants appear, run the <code class=\"\" data-line=\"\">GRANT ALL PRIVILEGES<\/code> line again and flush privileges.<\/p>\n<h3>cPanel says the database name already exists, but I can&#8217;t see it<\/h3>\n<p>cPanel checks database names across all accounts on a shared server \u2014 not just yours. If a name conflicts with another account&#8217;s database (even though you can&#8217;t see it), cPanel will reject it. Simply choose a more unique name. Adding a short project abbreviation usually resolves it: <code class=\"\" data-line=\"\">mysite_proj2_db<\/code> instead of <code class=\"\" data-line=\"\">mysite_db<\/code>.<\/p>\n<h3>App says it can&#8217;t connect, but credentials are correct<\/h3>\n<p>Check whether your app is trying to connect via <code class=\"\" data-line=\"\">localhost<\/code> or <code class=\"\" data-line=\"\">127.0.0.1<\/code>. In some environments \u2014 particularly with PHP and MySQL on Ubuntu \u2014 <code class=\"\" data-line=\"\">localhost<\/code> resolves to a Unix socket while <code class=\"\" data-line=\"\">127.0.0.1<\/code> uses TCP. If the MySQL user was created with <code class=\"\" data-line=\"\">@&#039;localhost&#039;<\/code> and your app connects via <code class=\"\" data-line=\"\">127.0.0.1<\/code>, MySQL may treat it as a different host and deny access. Try switching the host value in your config and test again.<\/p>\n<h3>GRANT command denied to user &#8216;root&#8217;@&#8217;localhost&#8217;<\/h3>\n<p>This usually means you&#8217;re logged in as a MySQL user that doesn&#8217;t actually have the GRANT OPTION, or on some managed database setups (like certain VPS control panel stacks) the root user&#8217;s privileges have been scoped down. Log out and back in with the actual system root account via <code class=\"\" data-line=\"\">sudo mysql<\/code>, not just <code class=\"\" data-line=\"\">mysql -u root -p<\/code>.<\/p>\n<h3>mysql_secure_installation fails or loops asking for a password<\/h3>\n<p>As mentioned above, this is the socket auth issue. Run <code class=\"\" data-line=\"\">sudo mysql<\/code> first, change root&#8217;s auth plugin with the <code class=\"\" data-line=\"\">ALTER USER<\/code> command shown in Method 3 Step 1, then exit and retry <code class=\"\" data-line=\"\">mysql_secure_installation<\/code>. This catches a lot of people on fresh Ubuntu\/Debian VPS installs.<\/p>\n<h2>FAQ<\/h2>\n<div class=\"ht-faq-section\">\n<h2>Frequently Asked Questions<\/h2>\n<div class=\"ht-faq-item\">\n<h3 class=\"ht-faq-question\">How many MySQL databases can I create on a cPanel hosting account?<\/h3>\n<div class=\"ht-faq-answer\">\n<p>It depends on your hosting plan. Shared hosting accounts typically have a limit set by the host \u2014 anywhere from 5 to unlimited databases depending on the package. You can check your current limit and usage under cPanel &gt; MySQL Databases. On a VPS or dedicated server where you manage MySQL directly, there&#8217;s no enforced limit beyond disk space.<\/p>\n<\/div>\n<\/div>\n<div class=\"ht-faq-item\">\n<h3 class=\"ht-faq-question\">What&#039;s the difference between a MySQL user and a database?<\/h3>\n<div class=\"ht-faq-answer\">\n<p>A database is the container that holds your data \u2014 tables, rows, all of it. A user is a credential set (username + password) that&#8217;s allowed to connect to MySQL. Creating a database without a user, or a user without linking them to a database, means nothing can actually connect. You need both, and you need to explicitly grant the user access to the database.<\/p>\n<\/div>\n<\/div>\n<div class=\"ht-faq-item\">\n<h3 class=\"ht-faq-question\">Can I use the same MySQL user for multiple databases?<\/h3>\n<div class=\"ht-faq-answer\">\n<p>Yes. You can run <code class=\"\" data-line=\"\">GRANT ALL PRIVILEGES ON seconddb.* TO &#039;myappuser&#039;@&#039;localhost&#039;;<\/code> to give an existing user access to another database. Just make sure that&#8217;s intentional \u2014 giving one application user access to another app&#8217;s database is a security risk if that app is ever compromised.<\/p>\n<\/div>\n<\/div>\n<div class=\"ht-faq-item\">\n<h3 class=\"ht-faq-question\">How do I delete a MySQL database and user I no longer need?<\/h3>\n<div class=\"ht-faq-answer\">\n<p>In cPanel, go to MySQL Databases, scroll down to find the database, and click Delete. You&#8217;ll also see a separate section to remove users. Via CLI: <code class=\"\" data-line=\"\">DROP DATABASE myappdb;<\/code> and <code class=\"\" data-line=\"\">DROP USER &#039;myappuser&#039;@&#039;localhost&#039;;<\/code> \u2014 run both from the MySQL prompt as root. Double-check you&#8217;re targeting the right database before running DROP; there&#8217;s no undo.<\/p>\n<\/div>\n<\/div>\n<div class=\"ht-faq-item\">\n<h3 class=\"ht-faq-question\">Do I need to restart MySQL after creating a new database or user?<\/h3>\n<div class=\"ht-faq-answer\">\n<p>No. Running <code class=\"\" data-line=\"\">FLUSH PRIVILEGES;<\/code> is enough to apply permission changes immediately without a restart. MySQL restarts are only needed for config file changes (like edits to <code class=\"\" data-line=\"\">my.cnf<\/code>). On a live server, restarting MySQL drops all active connections, so avoid it unless absolutely necessary.<\/p>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Whether you&#8217;re installing WordPress, setting up a custom app, or migrating a site, you&#8217;ll need a MySQL database and a dedicated user with the right permissions. This guide covers cPanel, Plesk, and direct CLI access \u2014 pick whichever matches your setup.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[59],"tags":[40,289,60,287,52,226,62,288],"class_list":["post-162","post","type-post","status-publish","format-standard","hentry","category-mysql","tag-cpanel","tag-create-mysql-database-and-user","tag-database","tag-mariadb","tag-mysql","tag-mysql-user-permissions","tag-plesk","tag-web-hosting-database"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Create a MySQL Database and User (cPanel, Plesk &amp; CLI)<\/title>\n<meta name=\"description\" content=\"Learn how to create a MySQL database and user in cPanel, Plesk, and via the command line. Includes permissions, common errors, and security tips.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/hostandtech.com\/kb\/mysql\/how-to-create-mysql-database-and-user\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Create a MySQL Database and User (cPanel, Plesk &amp; CLI)\" \/>\n<meta property=\"og:description\" content=\"Learn how to create a MySQL database and user in cPanel, Plesk, and via the command line. Includes permissions, common errors, and security tips.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/hostandtech.com\/kb\/mysql\/how-to-create-mysql-database-and-user\/\" \/>\n<meta property=\"og:site_name\" content=\"Host And Tech knowledge base\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/stshostandtech\" \/>\n<meta property=\"article:published_time\" content=\"2026-05-29T06:12:26+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@stshostandtech\" \/>\n<meta name=\"twitter:site\" content=\"@stshostandtech\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/hostandtech.com\\\/kb\\\/mysql\\\/how-to-create-mysql-database-and-user\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/hostandtech.com\\\/kb\\\/mysql\\\/how-to-create-mysql-database-and-user\\\/\"},\"author\":{\"name\":\"admin\",\"@id\":\"https:\\\/\\\/hostandtech.com\\\/kb\\\/#\\\/schema\\\/person\\\/b6fa79c48ddaba71af32e395c5b017ee\"},\"headline\":\"How to Create a MySQL Database and User (cPanel, Plesk &amp; CLI)\",\"datePublished\":\"2026-05-29T06:12:26+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/hostandtech.com\\\/kb\\\/mysql\\\/how-to-create-mysql-database-and-user\\\/\"},\"wordCount\":1706,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/hostandtech.com\\\/kb\\\/#organization\"},\"keywords\":[\"cPanel\",\"create MySQL database and user\",\"database\",\"mariadb\",\"MySQL\",\"mysql user permissions\",\"plesk\",\"web hosting database\"],\"articleSection\":[\"MySQL &amp; MariaDB\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/hostandtech.com\\\/kb\\\/mysql\\\/how-to-create-mysql-database-and-user\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/hostandtech.com\\\/kb\\\/mysql\\\/how-to-create-mysql-database-and-user\\\/\",\"url\":\"https:\\\/\\\/hostandtech.com\\\/kb\\\/mysql\\\/how-to-create-mysql-database-and-user\\\/\",\"name\":\"How to Create a MySQL Database and User (cPanel, Plesk & CLI)\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/hostandtech.com\\\/kb\\\/#website\"},\"datePublished\":\"2026-05-29T06:12:26+00:00\",\"description\":\"Learn how to create a MySQL database and user in cPanel, Plesk, and via the command line. Includes permissions, common errors, and security tips.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/hostandtech.com\\\/kb\\\/mysql\\\/how-to-create-mysql-database-and-user\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/hostandtech.com\\\/kb\\\/mysql\\\/how-to-create-mysql-database-and-user\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/hostandtech.com\\\/kb\\\/mysql\\\/how-to-create-mysql-database-and-user\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/hostandtech.com\\\/kb\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Create a MySQL Database and User (cPanel, Plesk &amp; CLI)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/hostandtech.com\\\/kb\\\/#website\",\"url\":\"https:\\\/\\\/hostandtech.com\\\/kb\\\/\",\"name\":\"Host And Tech knowledge base\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/hostandtech.com\\\/kb\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/hostandtech.com\\\/kb\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/hostandtech.com\\\/kb\\\/#organization\",\"name\":\"Host And Tech knowledge base\",\"url\":\"https:\\\/\\\/hostandtech.com\\\/kb\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/hostandtech.com\\\/kb\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/hostandtech.com\\\/kb\\\/wp-content\\\/uploads\\\/2026\\\/05\\\/logo-dark.png\",\"contentUrl\":\"https:\\\/\\\/hostandtech.com\\\/kb\\\/wp-content\\\/uploads\\\/2026\\\/05\\\/logo-dark.png\",\"width\":1134,\"height\":395,\"caption\":\"Host And Tech knowledge base\"},\"image\":{\"@id\":\"https:\\\/\\\/hostandtech.com\\\/kb\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/stshostandtech\",\"https:\\\/\\\/x.com\\\/stshostandtech\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/hostandtech.com\\\/kb\\\/#\\\/schema\\\/person\\\/b6fa79c48ddaba71af32e395c5b017ee\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/aa1edac8bbadb442e059a5b65ad45a3b2e3ce689202373b96e3e567517ae4b39?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/aa1edac8bbadb442e059a5b65ad45a3b2e3ce689202373b96e3e567517ae4b39?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/aa1edac8bbadb442e059a5b65ad45a3b2e3ce689202373b96e3e567517ae4b39?s=96&d=mm&r=g\",\"caption\":\"admin\"},\"sameAs\":[\"https:\\\/\\\/hostandtech.com\\\/kb\"],\"url\":\"https:\\\/\\\/hostandtech.com\\\/kb\\\/author\\\/admin_fjj7qydm\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Create a MySQL Database and User (cPanel, Plesk & CLI)","description":"Learn how to create a MySQL database and user in cPanel, Plesk, and via the command line. Includes permissions, common errors, and security tips.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/hostandtech.com\/kb\/mysql\/how-to-create-mysql-database-and-user\/","og_locale":"en_US","og_type":"article","og_title":"How to Create a MySQL Database and User (cPanel, Plesk & CLI)","og_description":"Learn how to create a MySQL database and user in cPanel, Plesk, and via the command line. Includes permissions, common errors, and security tips.","og_url":"https:\/\/hostandtech.com\/kb\/mysql\/how-to-create-mysql-database-and-user\/","og_site_name":"Host And Tech knowledge base","article_publisher":"https:\/\/www.facebook.com\/stshostandtech","article_published_time":"2026-05-29T06:12:26+00:00","author":"admin","twitter_card":"summary_large_image","twitter_creator":"@stshostandtech","twitter_site":"@stshostandtech","twitter_misc":{"Written by":"admin","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/hostandtech.com\/kb\/mysql\/how-to-create-mysql-database-and-user\/#article","isPartOf":{"@id":"https:\/\/hostandtech.com\/kb\/mysql\/how-to-create-mysql-database-and-user\/"},"author":{"name":"admin","@id":"https:\/\/hostandtech.com\/kb\/#\/schema\/person\/b6fa79c48ddaba71af32e395c5b017ee"},"headline":"How to Create a MySQL Database and User (cPanel, Plesk &amp; CLI)","datePublished":"2026-05-29T06:12:26+00:00","mainEntityOfPage":{"@id":"https:\/\/hostandtech.com\/kb\/mysql\/how-to-create-mysql-database-and-user\/"},"wordCount":1706,"commentCount":0,"publisher":{"@id":"https:\/\/hostandtech.com\/kb\/#organization"},"keywords":["cPanel","create MySQL database and user","database","mariadb","MySQL","mysql user permissions","plesk","web hosting database"],"articleSection":["MySQL &amp; MariaDB"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/hostandtech.com\/kb\/mysql\/how-to-create-mysql-database-and-user\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/hostandtech.com\/kb\/mysql\/how-to-create-mysql-database-and-user\/","url":"https:\/\/hostandtech.com\/kb\/mysql\/how-to-create-mysql-database-and-user\/","name":"How to Create a MySQL Database and User (cPanel, Plesk & CLI)","isPartOf":{"@id":"https:\/\/hostandtech.com\/kb\/#website"},"datePublished":"2026-05-29T06:12:26+00:00","description":"Learn how to create a MySQL database and user in cPanel, Plesk, and via the command line. Includes permissions, common errors, and security tips.","breadcrumb":{"@id":"https:\/\/hostandtech.com\/kb\/mysql\/how-to-create-mysql-database-and-user\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/hostandtech.com\/kb\/mysql\/how-to-create-mysql-database-and-user\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/hostandtech.com\/kb\/mysql\/how-to-create-mysql-database-and-user\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/hostandtech.com\/kb\/"},{"@type":"ListItem","position":2,"name":"How to Create a MySQL Database and User (cPanel, Plesk &amp; CLI)"}]},{"@type":"WebSite","@id":"https:\/\/hostandtech.com\/kb\/#website","url":"https:\/\/hostandtech.com\/kb\/","name":"Host And Tech knowledge base","description":"","publisher":{"@id":"https:\/\/hostandtech.com\/kb\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/hostandtech.com\/kb\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/hostandtech.com\/kb\/#organization","name":"Host And Tech knowledge base","url":"https:\/\/hostandtech.com\/kb\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/hostandtech.com\/kb\/#\/schema\/logo\/image\/","url":"https:\/\/hostandtech.com\/kb\/wp-content\/uploads\/2026\/05\/logo-dark.png","contentUrl":"https:\/\/hostandtech.com\/kb\/wp-content\/uploads\/2026\/05\/logo-dark.png","width":1134,"height":395,"caption":"Host And Tech knowledge base"},"image":{"@id":"https:\/\/hostandtech.com\/kb\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/stshostandtech","https:\/\/x.com\/stshostandtech"]},{"@type":"Person","@id":"https:\/\/hostandtech.com\/kb\/#\/schema\/person\/b6fa79c48ddaba71af32e395c5b017ee","name":"admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/aa1edac8bbadb442e059a5b65ad45a3b2e3ce689202373b96e3e567517ae4b39?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/aa1edac8bbadb442e059a5b65ad45a3b2e3ce689202373b96e3e567517ae4b39?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/aa1edac8bbadb442e059a5b65ad45a3b2e3ce689202373b96e3e567517ae4b39?s=96&d=mm&r=g","caption":"admin"},"sameAs":["https:\/\/hostandtech.com\/kb"],"url":"https:\/\/hostandtech.com\/kb\/author\/admin_fjj7qydm\/"}]}},"_links":{"self":[{"href":"https:\/\/hostandtech.com\/kb\/wp-json\/wp\/v2\/posts\/162","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hostandtech.com\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hostandtech.com\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hostandtech.com\/kb\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hostandtech.com\/kb\/wp-json\/wp\/v2\/comments?post=162"}],"version-history":[{"count":0,"href":"https:\/\/hostandtech.com\/kb\/wp-json\/wp\/v2\/posts\/162\/revisions"}],"wp:attachment":[{"href":"https:\/\/hostandtech.com\/kb\/wp-json\/wp\/v2\/media?parent=162"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hostandtech.com\/kb\/wp-json\/wp\/v2\/categories?post=162"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hostandtech.com\/kb\/wp-json\/wp\/v2\/tags?post=162"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}