{"id":24262,"date":"2022-02-02T14:27:24","date_gmt":"2022-02-02T14:27:24","guid":{"rendered":"https:\/\/1-grid.com\/knowledge\/vps-working-with-a-mysql-database\/"},"modified":"2023-08-31T07:30:29","modified_gmt":"2023-08-31T07:30:29","slug":"vps-working-with-a-mysql-database","status":"publish","type":"ht_kb","link":"https:\/\/1grid.co.za\/knowledge\/vps-working-with-a-mysql-database\/","title":{"rendered":"VPS: Working With a MySQL Database"},"content":{"rendered":"<blockquote><p><span style=\"font-family: Helvetica,sans-serif;\">This article provides you with information on how to manage MySQL on CentOS 7 server using root.<\/span><\/p><\/blockquote>\n<p><span style=\"font-family: Helvetica,sans-serif;\">\u00a0<\/span><\/p>\n<p><span style=\"font-family: Helvetica,sans-serif;\">\u00a0<\/span><\/p>\n<p><span style=\"font-family: Helvetica,sans-serif;\">\u00a0<\/span><\/p>\n<p style=\"box-sizing: border-box; -webkit-font-smoothing: antialiased; margin: 0.5rem 0px; font-family: 'Open Sans Regular', Arial, sans-serif; font-size: 16px; text-align: justify; line-height: 1.618; color: #444444; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;\"><span style=\"font-family: Helvetica,sans-serif;\">First, we\u2019ll log in to the MySQL server from the command line with the following command:<\/span><\/p>\n<p style=\"box-sizing: border-box; -webkit-font-smoothing: antialiased; margin: 0.5rem 0px; font-family: 'Open Sans Regular', Arial, sans-serif; font-size: 16px; text-align: justify; line-height: 1.618; color: #444444; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;\"><span style=\"font-family: Helvetica,sans-serif;\">\u00a0<\/span><\/p>\n<p style=\"box-sizing: border-box; -webkit-font-smoothing: antialiased; margin: 0.5rem 0px; font-family: 'Open Sans Regular', Arial, sans-serif; font-size: 16px; text-align: justify; line-height: 1.618; color: #444444; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;\"><span style=\"font-family: Helvetica,sans-serif;\"><code style=\"box-sizing: border-box; -webkit-font-smoothing: antialiased; font-family: monospace; font-size: 14.4px; padding: 5px; color: #ffffff; background: #000000; border-radius: 5px; text-align: left; display: block;\">mysql -u root -p<\/code><\/span><\/p>\n<p style=\"box-sizing: border-box; -webkit-font-smoothing: antialiased; margin: 0.5rem 0px; font-family: 'Open Sans Regular', Arial, sans-serif; font-size: 16px; text-align: justify; line-height: 1.618; color: #444444; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;\"><span style=\"font-family: Helvetica,sans-serif;\">\u00a0<\/span><\/p>\n<p style=\"box-sizing: border-box; -webkit-font-smoothing: antialiased; margin: 0.5rem 0px; font-family: 'Open Sans Regular', Arial, sans-serif; font-size: 16px; text-align: justify; line-height: 1.618; color: #444444; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;\"><span style=\"font-family: Helvetica,sans-serif;\">In this case, I\u2019ve specified the user <strong style=\"box-sizing: border-box; -webkit-font-smoothing: antialiased; font-weight: bold; font-family: 'Open Sans Regular', Arial, sans-serif;\">root<\/strong> with the <strong style=\"box-sizing: border-box; -webkit-font-smoothing: antialiased; font-weight: bold; font-family: 'Open Sans Regular', Arial, sans-serif;\">-u<\/strong> flag and then used the <strong style=\"box-sizing: border-box; -webkit-font-smoothing: antialiased; font-weight: bold; font-family: 'Open Sans Regular', Arial, sans-serif;\">-p<\/strong> flag so MySQL prompts for a password. Enter your current password to complete the login.<\/span><\/p>\n<p style=\"box-sizing: border-box; -webkit-font-smoothing: antialiased; margin: 0.5rem 0px; font-family: 'Open Sans Regular', Arial, sans-serif; font-size: 16px; text-align: justify; line-height: 1.618; color: #444444; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;\"><span style=\"font-family: Helvetica,sans-serif;\">\u00a0<\/span><\/p>\n<p style=\"box-sizing: border-box; -webkit-font-smoothing: antialiased; margin: 0.5rem 0px; font-family: 'Open Sans Regular', Arial, sans-serif; font-size: 16px; text-align: justify; line-height: 1.618; color: #444444; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;\"><span style=\"font-family: Helvetica,sans-serif;\">You should now be at a MySQL prompt that looks very similar to this:<\/span><\/p>\n<p style=\"box-sizing: border-box; -webkit-font-smoothing: antialiased; margin: 0.5rem 0px; font-family: 'Open Sans Regular', Arial, sans-serif; font-size: 16px; text-align: justify; line-height: 1.618; color: #444444; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;\"><span style=\"font-family: Helvetica,sans-serif;\"><code style=\"box-sizing: border-box; -webkit-font-smoothing: antialiased; font-family: monospace; font-size: 14.4px; padding: 5px; color: #ffffff; background: #000000; border-radius: 5px; text-align: left; display: block;\">mysql&gt;<\/code><\/span><\/p>\n<p style=\"box-sizing: border-box; -webkit-font-smoothing: antialiased; margin: 0.5rem 0px; font-family: 'Open Sans Regular', Arial, sans-serif; font-size: 16px; text-align: justify; line-height: 1.618; color: #444444; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;\"><span style=\"font-family: Helvetica,sans-serif;\">\u00a0<\/span><\/p>\n<h2 style=\"box-sizing: border-box; font-family: 'Open Sans Semibold', Arial, sans-serif; font-weight: 500; line-height: 42px; color: #444444; margin: 1rem 0px 0.5rem; font-size: 2rem; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; -webkit-font-smoothing: antialiased; text-align: left;\"><span style=\"box-sizing: border-box; font-family: Helvetica, sans-serif;\"><span style=\"box-sizing: border-box; font-size: 24px;\"><strong style=\"box-sizing: border-box; font-weight: bold;\"><span style=\"box-sizing: border-box; color: #000000;\">View All MySQL Databases<\/span><\/strong><\/span><\/span><\/h2>\n<p style=\"box-sizing: border-box; margin: 0.5rem 0px; font-size: 16px; line-height: 1.618; word-break: normal; overflow-wrap: break-word; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; -webkit-font-smoothing: antialiased; font-family: 'Open Sans Regular', Arial, sans-serif; text-align: justify; color: #444444;\"><span style=\"box-sizing: border-box; font-family: Helvetica, sans-serif;\">To view a list of databases simply issue the following command:<\/span><\/p>\n<p style=\"box-sizing: border-box; margin: 0.5rem 0px; font-size: 16px; line-height: 1.618; word-break: normal; overflow-wrap: break-word; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; -webkit-font-smoothing: antialiased; font-family: 'Open Sans Regular', Arial, sans-serif; text-align: justify; color: #444444;\"><span style=\"box-sizing: border-box; font-family: Helvetica, sans-serif;\"><code style=\"box-sizing: border-box; font-family: monospace; font-size: 14.4px; word-break: normal; overflow-wrap: break-word; -webkit-font-smoothing: antialiased; padding: 5px; color: #ffffff; background: #000000; border-radius: 5px; text-align: left; display: block;\">SHOW DATABASES;<\/code><\/span><\/p>\n<p style=\"box-sizing: border-box; margin: 0.5rem 0px; font-size: 16px; line-height: 1.618; word-break: normal; overflow-wrap: break-word; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; -webkit-font-smoothing: antialiased; font-family: 'Open Sans Regular', Arial, sans-serif; text-align: justify; color: #444444;\"><span style=\"box-sizing: border-box; font-family: Helvetica, sans-serif;\">\u00a0<\/span><\/p>\n<p style=\"box-sizing: border-box; margin: 0.5rem 0px; font-size: 16px; line-height: 1.618; word-break: normal; overflow-wrap: break-word; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; -webkit-font-smoothing: antialiased; font-family: 'Open Sans Regular', Arial, sans-serif; text-align: justify; color: #444444;\"><span style=\"box-sizing: border-box; font-family: Helvetica, sans-serif;\">Your result should be similar to this:<\/span><\/p>\n<p style=\"box-sizing: border-box; margin: 0.5rem 0px; font-size: 16px; line-height: 1.618; word-break: normal; overflow-wrap: break-word; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; -webkit-font-smoothing: antialiased; font-family: 'Open Sans Regular', Arial, sans-serif; text-align: justify; color: #444444;\"><span style=\"box-sizing: border-box; font-family: Helvetica, sans-serif;\">\u00a0<br style=\"box-sizing: border-box; -webkit-font-smoothing: antialiased;\" \/><code style=\"box-sizing: border-box; font-family: monospace; font-size: 14.4px; word-break: normal; overflow-wrap: break-word; -webkit-font-smoothing: antialiased; padding: 5px; color: #ffffff; background: #000000; border-radius: 5px; text-align: left; display: block;\">mysql&gt; SHOW DATABASES;<br style=\"box-sizing: border-box; -webkit-font-smoothing: antialiased;\" \/>+--------------------+<br style=\"box-sizing: border-box; -webkit-font-smoothing: antialiased;\" \/>| Database |<br style=\"box-sizing: border-box; -webkit-font-smoothing: antialiased;\" \/>+--------------------+<br style=\"box-sizing: border-box; -webkit-font-smoothing: antialiased;\" \/>| information_schema |<br style=\"box-sizing: border-box; -webkit-font-smoothing: antialiased;\" \/>| mysql |<br style=\"box-sizing: border-box; -webkit-font-smoothing: antialiased;\" \/>| test |<br style=\"box-sizing: border-box; -webkit-font-smoothing: antialiased;\" \/>+--------------------+<br style=\"box-sizing: border-box; -webkit-font-smoothing: antialiased;\" \/>4 rows in set (0.00 sec)<br style=\"box-sizing: border-box; -webkit-font-smoothing: antialiased;\" \/><\/code><\/span><\/p>\n<h2 style=\"box-sizing: border-box; -webkit-font-smoothing: antialiased; margin-bottom: 0.5rem; font-family: 'Open Sans Semibold', Arial, sans-serif; font-weight: 500; line-height: 42px; color: #444444; font-size: 2rem; text-align: left; text-indent: 0px;\"><span style=\"font-family: Helvetica,sans-serif;\"><span style=\"color: #000000;\"><strong><span style=\"font-size: 24px;\">Update a Database user password in MySQL<\/span><\/strong><\/span><\/span><\/h2>\n<p style=\"box-sizing: border-box; -webkit-font-smoothing: antialiased; margin: 0.5rem 0px; font-family: 'Open Sans Regular', Arial, sans-serif; font-size: 16px; text-align: justify; line-height: 1.618; color: #444444; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;\"><span style=\"font-family: Helvetica,sans-serif;\">We\u2019ll update the password for all MySQL users with the name <strong style=\"box-sizing: border-box; -webkit-font-smoothing: antialiased; font-weight: bold; font-family: 'Open Sans Regular', Arial, sans-serif;\">root<\/strong>. Be sure to replace <strong style=\"box-sizing: border-box; -webkit-font-smoothing: antialiased; font-weight: bold; font-family: 'Open Sans Regular', Arial, sans-serif;\">your_new_password<\/strong> with the actual new password:<\/span><\/p>\n<p style=\"box-sizing: border-box; -webkit-font-smoothing: antialiased; margin: 0.5rem 0px; font-family: 'Open Sans Regular', Arial, sans-serif; font-size: 16px; text-align: justify; line-height: 1.618; color: #444444; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;\"><span style=\"font-family: Helvetica,sans-serif;\">\u00a0<\/span><\/p>\n<p style=\"box-sizing: border-box; -webkit-font-smoothing: antialiased; margin: 0.5rem 0px; font-family: 'Open Sans Regular', Arial, sans-serif; font-size: 16px; text-align: justify; line-height: 1.618; color: #444444; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;\"><span style=\"font-family: Helvetica,sans-serif;\"><code style=\"box-sizing: border-box; -webkit-font-smoothing: antialiased; font-family: monospace; font-size: 14.4px; padding: 5px; color: #ffffff; background: #000000; border-radius: 5px; text-align: left; display: block;\">update user set password=PASSWORD('your_new_password') where User='root';<\/code><\/span><\/p>\n<div><span style=\"font-family: Helvetica,sans-serif;\"><strong>Note: You can change the password for any user with the above command. Simply specify that user\u2019s username in place of root.<\/strong><\/span><\/div>\n<p><span style=\"font-family: Helvetica,sans-serif;\">\u00a0<\/span><\/p>\n<p style=\"box-sizing: border-box; -webkit-font-smoothing: antialiased; margin: 0.5rem 0px; font-family: 'Open Sans Regular', Arial, sans-serif; font-size: 16px; text-align: justify; line-height: 1.618; color: #444444; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;\"><span style=\"font-family: Helvetica,sans-serif;\">Finally, reload the privileges:<\/span><\/p>\n<p style=\"box-sizing: border-box; -webkit-font-smoothing: antialiased; margin: 0.5rem 0px; font-family: 'Open Sans Regular', Arial, sans-serif; font-size: 16px; text-align: justify; line-height: 1.618; color: #444444; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;\"><span style=\"font-family: Helvetica,sans-serif;\"><code style=\"box-sizing: border-box; -webkit-font-smoothing: antialiased; font-family: monospace; font-size: 14.4px; padding: 5px; color: #ffffff; background: #000000; border-radius: 5px; text-align: left; display: block;\">flush privileges;<\/code><\/span><\/p>\n<h2 style=\"box-sizing: border-box; -webkit-font-smoothing: antialiased; margin-top: 1rem; margin-bottom: 0.5rem; font-family: 'Open Sans Semibold', Arial, sans-serif; font-weight: 500; line-height: 42px; color: #444444; font-size: 2rem; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;\"><span style=\"font-family: Helvetica,sans-serif;\"><span style=\"color: #000000;\"><strong><span style=\"font-size: 24px;\">Delete a Database in MySQL<\/span><\/strong><\/span><\/span><\/h2>\n<p style=\"box-sizing: border-box; -webkit-font-smoothing: antialiased; margin: 0.5rem 0px; font-family: 'Open Sans Regular', Arial, sans-serif; font-size: 16px; text-align: justify; line-height: 1.618; color: #444444; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;\"><span style=\"font-family: Helvetica,sans-serif;\">It only takes one simple command to delete a database in MySQL, but BEWARE; dropping a database can not be undone! The command is as follows:<\/span><\/p>\n<p style=\"box-sizing: border-box; -webkit-font-smoothing: antialiased; margin: 0.5rem 0px; font-family: 'Open Sans Regular', Arial, sans-serif; font-size: 16px; text-align: justify; line-height: 1.618; color: #444444; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;\"><span style=\"font-family: Helvetica,sans-serif;\">\u00a0<\/span><\/p>\n<p style=\"box-sizing: border-box; -webkit-font-smoothing: antialiased; margin: 0.5rem 0px; font-family: 'Open Sans Regular', Arial, sans-serif; font-size: 16px; text-align: justify; line-height: 1.618; color: #444444; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;\"><span style=\"font-family: Helvetica,sans-serif;\"><code style=\"box-sizing: border-box; -webkit-font-smoothing: antialiased; font-family: monospace; font-size: 14.4px; padding: 5px; color: #ffffff; background: #000000; border-radius: 5px; text-align: left; display: block;\">DROP DATABASE tutorial_database;<\/code><\/span><\/p>\n<p style=\"box-sizing: border-box; -webkit-font-smoothing: antialiased; margin: 0.5rem 0px; font-family: 'Open Sans Regular', Arial, sans-serif; font-size: 16px; text-align: justify; line-height: 1.618; color: #444444; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;\"><span style=\"font-family: Helvetica,sans-serif;\">\u00a0<\/span><\/p>\n<p style=\"box-sizing: border-box; -webkit-font-smoothing: antialiased; margin: 0.5rem 0px; font-family: 'Open Sans Regular', Arial, sans-serif; font-size: 16px; text-align: justify; line-height: 1.618; color: #444444; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;\"><span style=\"font-family: Helvetica,sans-serif;\">If a database with the name <strong style=\"box-sizing: border-box; -webkit-font-smoothing: antialiased; font-weight: bold; font-family: 'Open Sans Regular', Arial, sans-serif;\">tutorial_database<\/strong> does not exist, then you\u2019ll receive this error:<\/span><\/p>\n<p style=\"box-sizing: border-box; -webkit-font-smoothing: antialiased; margin: 0.5rem 0px; font-family: 'Open Sans Regular', Arial, sans-serif; font-size: 16px; text-align: justify; line-height: 1.618; color: #444444; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;\"><span style=\"font-family: Helvetica,sans-serif;\">\u00a0<\/span><\/p>\n<p style=\"box-sizing: border-box; -webkit-font-smoothing: antialiased; margin: 0.5rem 0px; font-family: 'Open Sans Regular', Arial, sans-serif; font-size: 16px; text-align: justify; line-height: 1.618; color: #444444; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;\"><span style=\"font-family: Helvetica,sans-serif;\"><code style=\"box-sizing: border-box; -webkit-font-smoothing: antialiased; font-family: monospace; font-size: 14.4px; padding: 5px; color: #ffffff; background: #000000; border-radius: 5px; text-align: left; display: block;\">ERROR 1008 (HY000): Can't drop database 'tutorial_database'; database doesn't exist<br style=\"box-sizing: border-box; -webkit-font-smoothing: antialiased;\" \/><\/code><\/span><\/p>\n<p style=\"box-sizing: border-box; -webkit-font-smoothing: antialiased; margin: 0.5rem 0px; font-family: 'Open Sans Regular', Arial, sans-serif; font-size: 16px; text-align: justify; line-height: 1.618; color: #444444; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;\"><span style=\"font-family: Helvetica,sans-serif;\">\u00a0<\/span><\/p>\n<p style=\"box-sizing: border-box; -webkit-font-smoothing: antialiased; margin: 0.5rem 0px; font-family: 'Open Sans Regular', Arial, sans-serif; font-size: 16px; text-align: justify; line-height: 1.618; color: #444444; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;\"><span style=\"font-family: Helvetica,sans-serif;\">To avoid seeing this error use the following command instead:<\/span><\/p>\n<p style=\"box-sizing: border-box; -webkit-font-smoothing: antialiased; margin: 0.5rem 0px; font-family: 'Open Sans Regular', Arial, sans-serif; font-size: 16px; text-align: justify; line-height: 1.618; color: #444444; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;\"><span style=\"font-family: Helvetica,sans-serif;\">\u00a0<\/span><\/p>\n<p style=\"box-sizing: border-box; -webkit-font-smoothing: antialiased; margin: 0.5rem 0px; font-family: 'Open Sans Regular', Arial, sans-serif; font-size: 16px; text-align: justify; line-height: 1.618; color: #444444; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;\"><span style=\"font-family: Helvetica,sans-serif;\"><code style=\"box-sizing: border-box; -webkit-font-smoothing: antialiased; font-family: monospace; font-size: 14.4px; padding: 5px; color: #ffffff; background: #000000; border-radius: 5px; text-align: left; display: block;\">DROP DATABASE IF EXISTS tutorial_database;<\/code><\/span><\/p>\n<p style=\"box-sizing: border-box; -webkit-font-smoothing: antialiased; margin: 0.5rem 0px; font-family: 'Open Sans Regular', Arial, sans-serif; font-size: 16px; text-align: justify; line-height: 1.618; color: #444444; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;\"><span style=\"font-family: Helvetica,sans-serif;\">\u00a0<\/span><\/p>\n<p style=\"box-sizing: border-box; -webkit-font-smoothing: antialiased; margin: 0.5rem 0px; font-family: 'Open Sans Regular', Arial, sans-serif; font-size: 16px; text-align: justify; line-height: 1.618; color: #444444; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;\"><span style=\"font-family: Helvetica,sans-serif;\">The above command will only drop the database <strong style=\"box-sizing: border-box; -webkit-font-smoothing: antialiased; font-weight: bold; font-family: 'Open Sans Regular', Arial, sans-serif;\">tutorial_database<\/strong> if a database of that name exists.<\/span><\/p>\n<h2 style=\"box-sizing: border-box; -webkit-font-smoothing: antialiased; margin-top: 1rem; margin-bottom: 0.5rem; font-family: 'Open Sans Semibold', Arial, sans-serif; font-weight: 500; line-height: 42px; color: #444444; font-size: 2rem; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;\"><\/h2>\n<p style=\"box-sizing: border-box; -webkit-font-smoothing: antialiased; margin: 0.5rem 0px; font-family: 'Open Sans Regular', Arial, sans-serif; font-size: 16px; text-align: justify; line-height: 1.618; color: #444444; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;\">\n","protected":false},"excerpt":{"rendered":"<p>This article provides you with information on how to manage MySQL on CentOS 7 server using root. \u00a0 \u00a0 \u00a0 First, we\u2019ll log in to the MySQL server from the command line with the following command: \u00a0 mysql -u root -p \u00a0 In this case, I\u2019ve specified the user root&#8230;<\/p>\n","protected":false},"author":21,"comment_status":"closed","ping_status":"closed","template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"ht-kb-category":[1178],"ht-kb-tag":[270,662,1101,1106],"class_list":["post-24262","ht_kb","type-ht_kb","status-publish","format-standard","hentry","ht_kb_category-servers","ht_kb_tag-database","ht_kb_tag-mysql","ht_kb_tag-vps","ht_kb_tag-web-hosting"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.0 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>VPS: Working With a MySQL Database - 1-grid Knowledge Base<\/title>\n<meta name=\"robots\" content=\"noindex, follow\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"VPS: Working With a MySQL Database - 1-grid Knowledge Base\" \/>\n<meta property=\"og:description\" content=\"This article provides you with information on how to manage MySQL on CentOS 7 server using root. \u00a0 \u00a0 \u00a0 First, we\u2019ll log in to the MySQL server from the command line with the following command: \u00a0 mysql -u root -p \u00a0 In this case, I\u2019ve specified the user root...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/1grid.co.za\/knowledge\/vps-working-with-a-mysql-database\/\" \/>\n<meta property=\"og:site_name\" content=\"1-grid Knowledge Base\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/1grid.co.za\/\" \/>\n<meta property=\"article:modified_time\" content=\"2023-08-31T07:30:29+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@1grid_hosting\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/1grid.co.za\/knowledge\/vps-working-with-a-mysql-database\/\",\"url\":\"https:\/\/1grid.co.za\/knowledge\/vps-working-with-a-mysql-database\/\",\"name\":\"VPS: Working With a MySQL Database - 1-grid Knowledge Base\",\"isPartOf\":{\"@id\":\"https:\/\/1grid.co.za\/knowledge\/#website\"},\"datePublished\":\"2022-02-02T14:27:24+00:00\",\"dateModified\":\"2023-08-31T07:30:29+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/1grid.co.za\/knowledge\/vps-working-with-a-mysql-database\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/1grid.co.za\/knowledge\/vps-working-with-a-mysql-database\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/1grid.co.za\/knowledge\/vps-working-with-a-mysql-database\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/1grid.co.za\/knowledge\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"VPS: Working With a MySQL Database\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/1grid.co.za\/knowledge\/#website\",\"url\":\"https:\/\/1grid.co.za\/knowledge\/\",\"name\":\"1-Grid Domain Hosting Knowledge Base\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/1grid.co.za\/knowledge\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/1grid.co.za\/knowledge\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/1grid.co.za\/knowledge\/#organization\",\"name\":\"1-Grid Domain Hosting Knowledge Base\",\"url\":\"https:\/\/1grid.co.za\/knowledge\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/1grid.co.za\/knowledge\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/1grid.co.za\/knowledge\/wp-content\/uploads\/2023\/01\/1-grid-logo-color.svg\",\"contentUrl\":\"https:\/\/1grid.co.za\/knowledge\/wp-content\/uploads\/2023\/01\/1-grid-logo-color.svg\",\"width\":100,\"height\":100,\"caption\":\"1-Grid Domain Hosting Knowledge Base\"},\"image\":{\"@id\":\"https:\/\/1grid.co.za\/knowledge\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/1grid.co.za\/\",\"https:\/\/twitter.com\/1grid_hosting\",\"https:\/\/www.instagram.com\/1grid_hosting\/\",\"https:\/\/za.linkedin.com\/company\/1-grid\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"VPS: Working With a MySQL Database - 1-grid Knowledge Base","robots":{"index":"noindex","follow":"follow"},"og_locale":"en_US","og_type":"article","og_title":"VPS: Working With a MySQL Database - 1-grid Knowledge Base","og_description":"This article provides you with information on how to manage MySQL on CentOS 7 server using root. \u00a0 \u00a0 \u00a0 First, we\u2019ll log in to the MySQL server from the command line with the following command: \u00a0 mysql -u root -p \u00a0 In this case, I\u2019ve specified the user root...","og_url":"https:\/\/1grid.co.za\/knowledge\/vps-working-with-a-mysql-database\/","og_site_name":"1-grid Knowledge Base","article_publisher":"https:\/\/www.facebook.com\/1grid.co.za\/","article_modified_time":"2023-08-31T07:30:29+00:00","twitter_card":"summary_large_image","twitter_site":"@1grid_hosting","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/1grid.co.za\/knowledge\/vps-working-with-a-mysql-database\/","url":"https:\/\/1grid.co.za\/knowledge\/vps-working-with-a-mysql-database\/","name":"VPS: Working With a MySQL Database - 1-grid Knowledge Base","isPartOf":{"@id":"https:\/\/1grid.co.za\/knowledge\/#website"},"datePublished":"2022-02-02T14:27:24+00:00","dateModified":"2023-08-31T07:30:29+00:00","breadcrumb":{"@id":"https:\/\/1grid.co.za\/knowledge\/vps-working-with-a-mysql-database\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/1grid.co.za\/knowledge\/vps-working-with-a-mysql-database\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/1grid.co.za\/knowledge\/vps-working-with-a-mysql-database\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/1grid.co.za\/knowledge\/"},{"@type":"ListItem","position":2,"name":"VPS: Working With a MySQL Database"}]},{"@type":"WebSite","@id":"https:\/\/1grid.co.za\/knowledge\/#website","url":"https:\/\/1grid.co.za\/knowledge\/","name":"1-Grid Domain Hosting Knowledge Base","description":"","publisher":{"@id":"https:\/\/1grid.co.za\/knowledge\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/1grid.co.za\/knowledge\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/1grid.co.za\/knowledge\/#organization","name":"1-Grid Domain Hosting Knowledge Base","url":"https:\/\/1grid.co.za\/knowledge\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/1grid.co.za\/knowledge\/#\/schema\/logo\/image\/","url":"https:\/\/1grid.co.za\/knowledge\/wp-content\/uploads\/2023\/01\/1-grid-logo-color.svg","contentUrl":"https:\/\/1grid.co.za\/knowledge\/wp-content\/uploads\/2023\/01\/1-grid-logo-color.svg","width":100,"height":100,"caption":"1-Grid Domain Hosting Knowledge Base"},"image":{"@id":"https:\/\/1grid.co.za\/knowledge\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/1grid.co.za\/","https:\/\/twitter.com\/1grid_hosting","https:\/\/www.instagram.com\/1grid_hosting\/","https:\/\/za.linkedin.com\/company\/1-grid"]}]}},"_links":{"self":[{"href":"https:\/\/1grid.co.za\/knowledge\/wp-json\/wp\/v2\/ht-kb\/24262","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/1grid.co.za\/knowledge\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/1grid.co.za\/knowledge\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/1grid.co.za\/knowledge\/wp-json\/wp\/v2\/users\/21"}],"replies":[{"embeddable":true,"href":"https:\/\/1grid.co.za\/knowledge\/wp-json\/wp\/v2\/comments?post=24262"}],"version-history":[{"count":2,"href":"https:\/\/1grid.co.za\/knowledge\/wp-json\/wp\/v2\/ht-kb\/24262\/revisions"}],"predecessor-version":[{"id":32851,"href":"https:\/\/1grid.co.za\/knowledge\/wp-json\/wp\/v2\/ht-kb\/24262\/revisions\/32851"}],"wp:attachment":[{"href":"https:\/\/1grid.co.za\/knowledge\/wp-json\/wp\/v2\/media?parent=24262"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/1grid.co.za\/knowledge\/wp-json\/wp\/v2\/ht-kb-category?post=24262"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/1grid.co.za\/knowledge\/wp-json\/wp\/v2\/ht-kb-tag?post=24262"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}