{"id":48612,"date":"2024-07-10T12:30:00","date_gmt":"2024-07-10T17:30:00","guid":{"rendered":"https:\/\/www.rosehosting.com\/blog\/?p=48612"},"modified":"2024-06-26T03:20:25","modified_gmt":"2024-06-26T08:20:25","slug":"how-to-manage-mysql-databases-and-users-from-the-command-line","status":"publish","type":"post","link":"https:\/\/www.rosehosting.com\/blog\/how-to-manage-mysql-databases-and-users-from-the-command-line\/","title":{"rendered":"How to Manage MySQL Databases and Users from the Command Line"},"content":{"rendered":"<div id=\"bsf_rt_marker\"><\/div>\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2024\/07\/how-to-manage-mysql-databases-and-users-from-the-command-line.webp\" alt=\"How to Manage MySQL Databases and Users from the Command Line\" class=\"wp-image-48723\" srcset=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2024\/07\/how-to-manage-mysql-databases-and-users-from-the-command-line.webp 1024w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2024\/07\/how-to-manage-mysql-databases-and-users-from-the-command-line-300x169.webp 300w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2024\/07\/how-to-manage-mysql-databases-and-users-from-the-command-line-150x84.webp 150w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2024\/07\/how-to-manage-mysql-databases-and-users-from-the-command-line-768x432.webp 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>MySQL is the most popular database server used by websites to store their important data. In addition to using phpMyAdmin to manage MySQL databases, we can do the same through MySQL shell commands. In this article, we will show you some basic commands to manage MySQL databases and Users.<\/p>\n\n\n\n<!--more-->\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-transparent ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-69f99315ad731\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"ez-toc-cssicon\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-69f99315ad731\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-manage-mysql-databases-and-users-from-the-command-line\/#How-to-Manage-MySQL-Databases\" >How to Manage MySQL Databases<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-manage-mysql-databases-and-users-from-the-command-line\/#How-to-Manage-a-User\" >How to Manage a User<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-manage-mysql-databases-and-users-from-the-command-line\/#You-can-now-manage-MySQL-Databases-and-Users-using-Command-Line\" >You can now manage MySQL Databases and Users using Command Line<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"How-to-Manage-MySQL-Databases\"><\/span>How to Manage MySQL Databases<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>In this section, we will show you how to add a new database, list databases, list tables inside a database, and simple queries to show data from a database. First, we need to log in to MySQL shell as the root user. Make sure you run this command below after logging in to your server through SSH.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ mysql -u root -p<\/pre>\n\n\n\n<p>You will be prompted to type your MySQL root password, and the password will not be shown on your screen. Just type the password and then hit ENTER. You will be in MySQL shell once connected.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Welcome to the MariaDB monitor.  Commands end with ; or \\g.<br>Your MariaDB connection id is 129124<br>Server version: 10.3.38-MariaDB-0ubuntu0.20.04.1 Ubuntu 20.04<br><br>Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.<br><br>Type 'help;' or '\\h' for help. Type '\\c' to clear the current input statement.<br><br>MariaDB [(none)]&gt;<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Create a Database<\/h3>\n\n\n\n<p>To create a database, you can execute this command in MySQL shell.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">CREATE DATABASE new_database;<\/pre>\n\n\n\n<p>That&#8217;s it, a database named &#8216;new_database&#8217; has been successfully created. You can replace &#8216;new_database&#8217; with your database name.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">List your MySQL Databases<\/h3>\n\n\n\n<p>After creating a database, you can check to verify if it&#8217;s created or not. To list the databases on your MySQL server, execute this command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">SHOW DATABASES;<\/pre>\n\n\n\n<p>The command above will print something like this:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">+--------------------+<br>| Database           |<br>+--------------------+<br>| data2024           |<br>| information_schema |<br>| mysql              |<br>| new_database       |<br>| performance_schema |<br>| postfixadmin       |<br>+--------------------+<br>6 rows in set (0.001 sec)<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Create a Table<\/h3>\n\n\n\n<p>To create a table inside a database, for example in the database new_database, we can run these commands.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">USE new_database;<\/pre>\n\n\n\n<p>The command above is executed to choose the database we want to insert a table to. Let&#8217;s create the table now.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">CREATE TABLE clients (<br>id INT AUTO_INCREMENT,<br>name varchar(200) NOT NULL,<br>address varchar(500),<br>email varchar(200),<br>sex varchar(100),<br>PRIMARY KEY(id)<br>) ENGINE=InnoDB;<\/pre>\n\n\n\n<p>The command should look like this on your screen:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">MariaDB [(none)]&gt; use new_database;<br>Database changed<br>MariaDB [new_database]&gt; CREATE TABLE clients (<br>    -&gt; id INT AUTO_INCREMENT,<br>    -&gt; name varchar(200) NOT NULL,<br>    -&gt; address varchar(500),<br>    -&gt; email varchar(200),<br>    -&gt; sex varchar(100),<br>    -&gt; PRIMARY KEY(id)<br>    -&gt; ) ENGINE=InnoDB;<br>Query OK, 0 rows affected (0.001 sec)<\/pre>\n\n\n\n<p>That&#8217;s it, you have successfully added a table called &#8216;clients&#8217; inside the database &#8216;new_database&#8217;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">List Tables<\/h3>\n\n\n\n<p>To check the tables inside a database, you can invoke this command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">SHOW TABLES;<\/pre>\n\n\n\n<p>The command will print you an output like this:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">MariaDB [new_database]&gt; show tables;<br>+------------------------+<br>| Tables_in_new_database |<br>+------------------------+<br>| clients |<br>+------------------------+<br>1 row in set (0.001 sec)<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Check Table Details<\/h3>\n\n\n\n<p>To check the table details, we can execute this command.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">DESCRIBE clients;<\/pre>\n\n\n\n<p>DESCRIBE is the command, while &#8216;clients&#8217; is the table name. You will see an output like this:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">MariaDB [new_database]&gt; describe clients;<br>+---------+--------------+------+-----+---------+----------------+<br>| Field   | Type         | Null | Key | Default | Extra          |<br>+---------+--------------+------+-----+---------+----------------+<br>| id      | int(11)      | NO   | PRI | NULL    | auto_increment |<br>| name    | varchar(200) | NO   |     | NULL    |                |<br>| address | varchar(500) | YES  |     | NULL    |                |<br>| email   | varchar(200) | YES  |     | NULL    |                |<br>| sex     | varchar(100) | YES  |     | NULL    |                |<br>+---------+--------------+------+-----+---------+----------------+<br>5 rows in set (0.004 sec)<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Insert a Record<\/h3>\n\n\n\n<p>To insert a new record to a table, we can run a command like this:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">INSERT INTO clients VALUES ('1','John Doe','New Street BLVD 01','john@doe.com','male');<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Check Data Inside a Table<\/h3>\n\n\n\n<p>To check the data inside a table, we can run the simple SELECT command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">SELECT * FROM clients;<\/pre>\n\n\n\n<p>The command will return an output similar to this:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">MariaDB [new_database]&gt; SELECT * from clients;<br>+----+----------+--------------------+--------------+------+<br>| id | name | address | email | sex |<br>+----+----------+--------------------+--------------+------+<br>| 1 | John Doe | New Street BLVD 01 | john@doe.com | male |<br>+----+----------+--------------------+--------------+------+<br>1 row in set (0.003 sec)<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"How-to-Manage-a-User\"><\/span>How to Manage a User<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>In the previous step, we have learned how to manage a MySQL database. Now, in this part, we are going to show you how to manage MySQL users.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Add a New User<\/h3>\n\n\n\n<p>Let&#8217;s execute this command below.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">CREATE USER 'new_user'@'localhost' IDENTIFIED BY 'm0d1fyth15';<\/pre>\n\n\n\n<p>The command above will create a new user called &#8216;new_user&#8217; with the password &#8216;m0d1fyth15&#8217;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Give access for the &#8216;new_user&#8217; to the database &#8216;new_database&#8217;<\/h3>\n\n\n\n<p>Execute this command to give the privileges to the new user we created earlier to the database named &#8216;new_database&#8217;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">GRANT ALL PRIVILEGES ON new_database.* TO 'new_user'@'localhost';<\/pre>\n\n\n\n<p>Flush the access right by running this command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">FLUSH PRIVILEGES;<\/pre>\n\n\n\n<p>At this point, the &#8216;new_user&#8217; has access to &#8216;new_database&#8217;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Revoke Privileges<\/h3>\n\n\n\n<p>If you want to remove the privileges you gave to user &#8216;new_user&#8217;, simply run this command<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">REVOKE ALL PRIVILEGES ON new_database.* FROM 'new_user'@'localhost';<\/pre>\n\n\n\n<p>Or, if you want to delete the MySQL user, run this simple command instead.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">DROP USER 'new_user'@'localhost';<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"You-can-now-manage-MySQL-Databases-and-Users-using-Command-Line\"><\/span>You can now manage MySQL Databases and Users using Command Line<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>If you are one of our web hosting customers and have an active server with us, you don\u2019t have to follow this tutorial and learn how to manage MySQL databases and users from the command line yourself. Our expert Linux admins will help you set up and manage your <a href=\"https:\/\/www.rosehosting.com\/mysql-hosting\/\" target=\"_blank\" rel=\"noreferrer noopener\">MySQL hosting<\/a>, databases, and users. They are available 24\u00d77 and will take care of your request immediately, and all you need to do is submit a ticket.<\/p>\n\n\n\n<p>If you liked this post please share it with your friends or leave a comment below.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>MySQL is the most popular database server used by websites to store their important data. In addition to using phpMyAdmin &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"How to Manage MySQL Databases and Users from the Command Line\" class=\"read-more button\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-manage-mysql-databases-and-users-from-the-command-line\/#more-48612\" aria-label=\"Read more about How to Manage MySQL Databases and Users from the Command Line\">Read More<\/a><\/p>\n","protected":false},"author":4,"featured_media":48723,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1702,1236,2071],"tags":[104,2153,39,1110],"class_list":["post-48612","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-databases","category-guides","category-linux","tag-command-line","tag-how-to-2","tag-mysql","tag-tips","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-33"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.5 (Yoast SEO v27.5) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Manage MySQL Databases and Users from the Command Line<\/title>\n<meta name=\"description\" content=\"Learn how to manage, backup, and restore MySQL databases and users using the powerful command line with our easy-to-follow guide.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-manage-mysql-databases-and-users-from-the-command-line\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Manage MySQL Databases and Users from the Command Line\" \/>\n<meta property=\"og:description\" content=\"How to Manage MySQL Databases and Users from the Command Line | RoseHosting\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.rosehosting.com\/blog\/how-to-manage-mysql-databases-and-users-from-the-command-line\/\" \/>\n<meta property=\"og:site_name\" content=\"RoseHosting\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/RoseHosting\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/rosehosting.helpdesk\" \/>\n<meta property=\"article:published_time\" content=\"2024-07-10T17:30:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2024\/07\/how-to-manage-mysql-databases-and-users-from-the-command-line.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"1024\" \/>\n\t<meta property=\"og:image:height\" content=\"576\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"Jeff Wilson\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@rosehosting\" \/>\n<meta name=\"twitter:site\" content=\"@rosehosting\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jeff Wilson\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-manage-mysql-databases-and-users-from-the-command-line\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-manage-mysql-databases-and-users-from-the-command-line\\\/\"},\"author\":{\"name\":\"Jeff Wilson\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#\\\/schema\\\/person\\\/7ce77a842fa6a9a7f8efa186f2353713\"},\"headline\":\"How to Manage MySQL Databases and Users from the Command Line\",\"datePublished\":\"2024-07-10T17:30:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-manage-mysql-databases-and-users-from-the-command-line\\\/\"},\"wordCount\":646,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-manage-mysql-databases-and-users-from-the-command-line\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/07\\\/how-to-manage-mysql-databases-and-users-from-the-command-line.webp\",\"keywords\":[\"Command Line\",\"how to\",\"mysql\",\"tips\"],\"articleSection\":[\"Databases\",\"Guides\",\"Linux\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-manage-mysql-databases-and-users-from-the-command-line\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-manage-mysql-databases-and-users-from-the-command-line\\\/\",\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-manage-mysql-databases-and-users-from-the-command-line\\\/\",\"name\":\"Manage MySQL Databases and Users from the Command Line\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-manage-mysql-databases-and-users-from-the-command-line\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-manage-mysql-databases-and-users-from-the-command-line\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/07\\\/how-to-manage-mysql-databases-and-users-from-the-command-line.webp\",\"datePublished\":\"2024-07-10T17:30:00+00:00\",\"description\":\"Learn how to manage, backup, and restore MySQL databases and users using the powerful command line with our easy-to-follow guide.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-manage-mysql-databases-and-users-from-the-command-line\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-manage-mysql-databases-and-users-from-the-command-line\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-manage-mysql-databases-and-users-from-the-command-line\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/07\\\/how-to-manage-mysql-databases-and-users-from-the-command-line.webp\",\"contentUrl\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/07\\\/how-to-manage-mysql-databases-and-users-from-the-command-line.webp\",\"width\":1024,\"height\":576,\"caption\":\"How to Manage MySQL Databases and Users from the Command Line\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-manage-mysql-databases-and-users-from-the-command-line\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Manage MySQL Databases and Users from the Command Line\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/\",\"name\":\"RoseHosting.com\",\"description\":\"Premium Linux Tutorials Since 2001\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#organization\",\"name\":\"RoseHosting\",\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/03\\\/android-chrome-192x192-1.png\",\"contentUrl\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/03\\\/android-chrome-192x192-1.png\",\"width\":192,\"height\":192,\"caption\":\"RoseHosting\"},\"image\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/RoseHosting\",\"https:\\\/\\\/x.com\\\/rosehosting\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/rosehosting\\\/\"],\"description\":\"RoseHosting is a leading Linux hosting provider, serving thousands of clients world-wide since 2001.\",\"email\":\"info@rosehosting.com\",\"telephone\":\"(314) 275-0414\",\"legalName\":\"Rose Web Services LLC\",\"foundingDate\":\"2001-04-02\",\"numberOfEmployees\":{\"@type\":\"QuantitativeValue\",\"minValue\":\"11\",\"maxValue\":\"50\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#\\\/schema\\\/person\\\/7ce77a842fa6a9a7f8efa186f2353713\",\"name\":\"Jeff Wilson\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g\",\"caption\":\"Jeff Wilson\"},\"description\":\"An experienced Linux veteran with many years of experience. Helping other Linux admins with frequent Linux and business-related blog posts on the RoseHosting blog. Techie by choice. Loving nature and travel. Happily married and father of two lovely children.\",\"sameAs\":[\"https:\\\/\\\/www.rosehosting.com\",\"https:\\\/\\\/www.facebook.com\\\/rosehosting.helpdesk\"],\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/author\\\/jwilson\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Manage MySQL Databases and Users from the Command Line","description":"Learn how to manage, backup, and restore MySQL databases and users using the powerful command line with our easy-to-follow guide.","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:\/\/www.rosehosting.com\/blog\/how-to-manage-mysql-databases-and-users-from-the-command-line\/","og_locale":"en_US","og_type":"article","og_title":"How to Manage MySQL Databases and Users from the Command Line","og_description":"How to Manage MySQL Databases and Users from the Command Line | RoseHosting","og_url":"https:\/\/www.rosehosting.com\/blog\/how-to-manage-mysql-databases-and-users-from-the-command-line\/","og_site_name":"RoseHosting","article_publisher":"https:\/\/www.facebook.com\/RoseHosting","article_author":"https:\/\/www.facebook.com\/rosehosting.helpdesk","article_published_time":"2024-07-10T17:30:00+00:00","og_image":[{"width":1024,"height":576,"url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2024\/07\/how-to-manage-mysql-databases-and-users-from-the-command-line.webp","type":"image\/webp"}],"author":"Jeff Wilson","twitter_card":"summary_large_image","twitter_creator":"@rosehosting","twitter_site":"@rosehosting","twitter_misc":{"Written by":"Jeff Wilson","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.rosehosting.com\/blog\/how-to-manage-mysql-databases-and-users-from-the-command-line\/#article","isPartOf":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-manage-mysql-databases-and-users-from-the-command-line\/"},"author":{"name":"Jeff Wilson","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713"},"headline":"How to Manage MySQL Databases and Users from the Command Line","datePublished":"2024-07-10T17:30:00+00:00","mainEntityOfPage":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-manage-mysql-databases-and-users-from-the-command-line\/"},"wordCount":646,"commentCount":0,"publisher":{"@id":"https:\/\/www.rosehosting.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-manage-mysql-databases-and-users-from-the-command-line\/#primaryimage"},"thumbnailUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2024\/07\/how-to-manage-mysql-databases-and-users-from-the-command-line.webp","keywords":["Command Line","how to","mysql","tips"],"articleSection":["Databases","Guides","Linux"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.rosehosting.com\/blog\/how-to-manage-mysql-databases-and-users-from-the-command-line\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.rosehosting.com\/blog\/how-to-manage-mysql-databases-and-users-from-the-command-line\/","url":"https:\/\/www.rosehosting.com\/blog\/how-to-manage-mysql-databases-and-users-from-the-command-line\/","name":"Manage MySQL Databases and Users from the Command Line","isPartOf":{"@id":"https:\/\/www.rosehosting.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-manage-mysql-databases-and-users-from-the-command-line\/#primaryimage"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-manage-mysql-databases-and-users-from-the-command-line\/#primaryimage"},"thumbnailUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2024\/07\/how-to-manage-mysql-databases-and-users-from-the-command-line.webp","datePublished":"2024-07-10T17:30:00+00:00","description":"Learn how to manage, backup, and restore MySQL databases and users using the powerful command line with our easy-to-follow guide.","breadcrumb":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-manage-mysql-databases-and-users-from-the-command-line\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.rosehosting.com\/blog\/how-to-manage-mysql-databases-and-users-from-the-command-line\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.rosehosting.com\/blog\/how-to-manage-mysql-databases-and-users-from-the-command-line\/#primaryimage","url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2024\/07\/how-to-manage-mysql-databases-and-users-from-the-command-line.webp","contentUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2024\/07\/how-to-manage-mysql-databases-and-users-from-the-command-line.webp","width":1024,"height":576,"caption":"How to Manage MySQL Databases and Users from the Command Line"},{"@type":"BreadcrumbList","@id":"https:\/\/www.rosehosting.com\/blog\/how-to-manage-mysql-databases-and-users-from-the-command-line\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.rosehosting.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Manage MySQL Databases and Users from the Command Line"}]},{"@type":"WebSite","@id":"https:\/\/www.rosehosting.com\/blog\/#website","url":"https:\/\/www.rosehosting.com\/blog\/","name":"RoseHosting.com","description":"Premium Linux Tutorials Since 2001","publisher":{"@id":"https:\/\/www.rosehosting.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.rosehosting.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.rosehosting.com\/blog\/#organization","name":"RoseHosting","url":"https:\/\/www.rosehosting.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/03\/android-chrome-192x192-1.png","contentUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/03\/android-chrome-192x192-1.png","width":192,"height":192,"caption":"RoseHosting"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/RoseHosting","https:\/\/x.com\/rosehosting","https:\/\/www.linkedin.com\/in\/rosehosting\/"],"description":"RoseHosting is a leading Linux hosting provider, serving thousands of clients world-wide since 2001.","email":"info@rosehosting.com","telephone":"(314) 275-0414","legalName":"Rose Web Services LLC","foundingDate":"2001-04-02","numberOfEmployees":{"@type":"QuantitativeValue","minValue":"11","maxValue":"50"}},{"@type":"Person","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713","name":"Jeff Wilson","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g","caption":"Jeff Wilson"},"description":"An experienced Linux veteran with many years of experience. Helping other Linux admins with frequent Linux and business-related blog posts on the RoseHosting blog. Techie by choice. Loving nature and travel. Happily married and father of two lovely children.","sameAs":["https:\/\/www.rosehosting.com","https:\/\/www.facebook.com\/rosehosting.helpdesk"],"url":"https:\/\/www.rosehosting.com\/blog\/author\/jwilson\/"}]}},"_links":{"self":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/48612","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/comments?post=48612"}],"version-history":[{"count":4,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/48612\/revisions"}],"predecessor-version":[{"id":48724,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/48612\/revisions\/48724"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/media\/48723"}],"wp:attachment":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/media?parent=48612"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/categories?post=48612"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/tags?post=48612"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}