{"id":1623,"date":"2018-03-01T12:34:40","date_gmt":"2018-03-01T17:34:40","guid":{"rendered":"http:\/\/bluegalaxy.info\/codewalk\/?p=1623"},"modified":"2018-03-01T15:25:42","modified_gmt":"2018-03-01T20:25:42","slug":"mysql-install-test-database-confirm-installation","status":"publish","type":"post","link":"https:\/\/bluegalaxy.info\/codewalk\/2018\/03\/01\/mysql-install-test-database-confirm-installation\/","title":{"rendered":"MySQL: How to install a test database and confirm the installation"},"content":{"rendered":"<p>Now that I have installed PHP and MySQL:<\/p>\n<blockquote class=\"wp-embedded-content\" data-secret=\"6q3fqtb4mp\"><p><a href=\"http:\/\/bluegalaxy.info\/codewalk\/2018\/02\/27\/install-php-mysql-confirm-installation\/\">How to install PHP\/MySQL and confirm the installation<\/a><\/p><\/blockquote>\n<p><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" src=\"http:\/\/bluegalaxy.info\/codewalk\/2018\/02\/27\/install-php-mysql-confirm-installation\/embed\/#?secret=6q3fqtb4mp\" data-secret=\"6q3fqtb4mp\" width=\"600\" height=\"338\" title=\"&#8220;How to install PHP\/MySQL and confirm the installation&#8221; &#8212; Chris Nielsen Code Walk\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><\/p>\n<p>I wanted to start using MySQL so I searched for a sample database full of data that I could install for testing. I found this &#8220;Employee Sample Database&#8221; on the dev.mysql.com website:<br \/>\n<a href=\"https:\/\/dev.mysql.com\/doc\/employee\/en\/\">https:\/\/dev.mysql.com\/doc\/employee\/en\/<\/a><\/p>\n<p>The instructions for installation:<br \/>\n<a href=\"https:\/\/dev.mysql.com\/doc\/employee\/en\/employees-installation.html\">https:\/\/dev.mysql.com\/doc\/employee\/en\/employees-installation.html<\/a><\/p>\n<p>led me to a github repository where I could download the database:<br \/>\n<a href=\"https:\/\/github.com\/datacharmer\/test_db\">https:\/\/github.com\/datacharmer\/test_db<\/a><\/p>\n<p>To download the database on this page, click the green &#8220;Clone or download&#8221; button, then choose &#8220;Download ZIP&#8221;.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" id=\"img_ds\" class=\"alignnone size-full wp-image-1625\" src=\"http:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/03\/git_download.png\" alt=\"\" width=\"404\" height=\"210\" srcset=\"https:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/03\/git_download.png 404w, https:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/03\/git_download-300x156.png 300w\" sizes=\"auto, (max-width: 404px) 100vw, 404px\" \/><\/p>\n<p>Once downloaded, I moved and unzipped the file to a folder MySQL folder on my desktop which I called &#8220;employees_sample_db&#8221;. Inside this folder is a file called employees.sql, which is critical for the install.<\/p>\n<p>The next step is to open a command window and cd to the directory where the sample database is stored.<\/p>\n<p>Caution: If you use a short command that doesn&#8217;t specify the user or trigger a password, such as:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"no-highlight\">mysql &lt; employees.sql<\/pre>\n<p>then you will get an error that looks like this:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" id=\"img_ds\" class=\"alignnone size-full wp-image-1627\" src=\"http:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/03\/mysql1045.png\" alt=\"\" width=\"832\" height=\"65\" srcset=\"https:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/03\/mysql1045.png 832w, https:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/03\/mysql1045-300x23.png 300w, https:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/03\/mysql1045-768x60.png 768w, https:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/03\/mysql1045-676x53.png 676w\" sizes=\"auto, (max-width: 832px) 100vw, 832px\" \/><\/p>\n<p>This is because you didn&#8217;t select a user with the -u flag (so Microsoft defaulted the user to &#8216;ODBC&#8217; for some reason), and you didn&#8217;t trigger password collection with -p.<\/p>\n<p>To avoid this error, we will use this command to install the database:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"no-highlight\">mysql -u root -p &lt; employees.sql<\/pre>\n<p>which means install the sample database under user &#8216;root&#8217; and ask for root&#8217;s password for the command.<\/p>\n<p>To see a list of possible users and double check or reset their passwords, I opened Bitnami&#8217;s WAMP Stack Manager app and clicked the &#8220;Open phpMyAdmin&#8221; button:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" id=\"img_ds\" class=\"alignnone size-full wp-image-1629\" src=\"http:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/03\/phpMyAdminbutton.png\" alt=\"\" width=\"547\" height=\"402\" srcset=\"https:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/03\/phpMyAdminbutton.png 547w, https:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/03\/phpMyAdminbutton-300x220.png 300w\" sizes=\"auto, (max-width: 547px) 100vw, 547px\" \/><\/p>\n<p>This launches the phpMyAdmin tool which is for managing MySQL databases and running SQL queries:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" id=\"img_ds\" class=\"alignnone wp-image-1630\" src=\"http:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/03\/phpMyAdmin.png\" alt=\"\" width=\"737\" height=\"628\" srcset=\"https:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/03\/phpMyAdmin.png 1198w, https:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/03\/phpMyAdmin-300x256.png 300w, https:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/03\/phpMyAdmin-768x655.png 768w, https:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/03\/phpMyAdmin-1024x873.png 1024w, https:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/03\/phpMyAdmin-676x576.png 676w\" sizes=\"auto, (max-width: 737px) 100vw, 737px\" \/><\/p>\n<p>To see a list of user accounts and manage permissions and passwords, click the &#8220;User accounts&#8221; link at the top. There will be a table that looks like this:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" id=\"img_ds\" class=\"alignnone size-full wp-image-1636\" src=\"http:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/03\/mysqluac.png\" alt=\"\" width=\"703\" height=\"215\" srcset=\"https:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/03\/mysqluac.png 703w, https:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/03\/mysqluac-300x92.png 300w, https:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/03\/mysqluac-676x207.png 676w\" sizes=\"auto, (max-width: 703px) 100vw, 703px\" \/><\/p>\n<p>Now going back to the command line, after you enter the password when prompted, you should see something like this which indicates the mysql database being loaded:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" id=\"img_ds\" class=\"alignnone size-full wp-image-1640\" src=\"http:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/03\/mysql_loading2.png\" alt=\"\" width=\"283\" height=\"332\" srcset=\"https:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/03\/mysql_loading2.png 283w, https:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/03\/mysql_loading2-256x300.png 256w\" sizes=\"auto, (max-width: 283px) 100vw, 283px\" \/><\/p>\n<p>Then we can use this command to test the database installation:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"no-highlight\">mysql -t &lt; test_employees_md5.sql<\/pre>\n<p>which yields:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" id=\"img_ds\" class=\"alignnone size-full wp-image-1642\" src=\"http:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/03\/test_employees.png\" alt=\"\" width=\"735\" height=\"869\" srcset=\"https:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/03\/test_employees.png 735w, https:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/03\/test_employees-254x300.png 254w, https:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/03\/test_employees-676x799.png 676w\" sizes=\"auto, (max-width: 735px) 100vw, 735px\" \/><\/p>\n<p>Finally, we can use the SQL dialog in the phpMyAdmin utility to query against the new database. The first query I would run is:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"no-highlight\">SHOW DATABASES;<\/pre>\n<p>which yields:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" id=\"img_ds\" class=\"alignnone size-full wp-image-1646\" src=\"http:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/03\/show_databases.png\" alt=\"\" width=\"329\" height=\"282\" srcset=\"https:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/03\/show_databases.png 329w, https:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/03\/show_databases-300x257.png 300w\" sizes=\"auto, (max-width: 329px) 100vw, 329px\" \/><\/p>\n<p>Then I used these SQL commands, (in order):<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"no-highlight\">USE employees;<\/pre>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"no-highlight\">SELECT * from employees;<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" id=\"img_ds\" class=\"alignnone size-full wp-image-1656\" src=\"http:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/03\/employee_splat-1.png\" alt=\"\" width=\"749\" height=\"274\" srcset=\"https:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/03\/employee_splat-1.png 749w, https:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/03\/employee_splat-1-300x110.png 300w, https:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/03\/employee_splat-1-676x247.png 676w\" sizes=\"auto, (max-width: 749px) 100vw, 749px\" \/><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"no-highlight\">SELECT * from employees where first_name like \"Berni\";<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" id=\"img_ds\" class=\"alignnone size-full wp-image-1657\" src=\"http:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/03\/emp_berni-1.png\" alt=\"\" width=\"749\" height=\"271\" srcset=\"https:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/03\/emp_berni-1.png 749w, https:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/03\/emp_berni-1-300x109.png 300w, https:\/\/bluegalaxy.info\/codewalk\/wp-content\/uploads\/2018\/03\/emp_berni-1-676x245.png 676w\" sizes=\"auto, (max-width: 749px) 100vw, 749px\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Now that I have installed PHP and MySQL: How to install PHP\/MySQL and confirm the installation I wanted to start using MySQL so I searched for a sample database full of data that I could install for testing. I found this &#8220;Employee Sample Database&#8221; on the dev.mysql.com website: https:\/\/dev.mysql.com\/doc\/employee\/en\/ The instructions for installation: https:\/\/dev.mysql.com\/doc\/employee\/en\/employees-installation.html led &hellip; <a href=\"https:\/\/bluegalaxy.info\/codewalk\/2018\/03\/01\/mysql-install-test-database-confirm-installation\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">MySQL: How to install a test database and confirm the installation<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[112],"tags":[108,43],"class_list":["post-1623","post","type-post","status-publish","format-standard","hentry","category-mysql","tag-mysql","tag-sql"],"_links":{"self":[{"href":"https:\/\/bluegalaxy.info\/codewalk\/wp-json\/wp\/v2\/posts\/1623","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bluegalaxy.info\/codewalk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bluegalaxy.info\/codewalk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bluegalaxy.info\/codewalk\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bluegalaxy.info\/codewalk\/wp-json\/wp\/v2\/comments?post=1623"}],"version-history":[{"count":21,"href":"https:\/\/bluegalaxy.info\/codewalk\/wp-json\/wp\/v2\/posts\/1623\/revisions"}],"predecessor-version":[{"id":1660,"href":"https:\/\/bluegalaxy.info\/codewalk\/wp-json\/wp\/v2\/posts\/1623\/revisions\/1660"}],"wp:attachment":[{"href":"https:\/\/bluegalaxy.info\/codewalk\/wp-json\/wp\/v2\/media?parent=1623"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bluegalaxy.info\/codewalk\/wp-json\/wp\/v2\/categories?post=1623"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bluegalaxy.info\/codewalk\/wp-json\/wp\/v2\/tags?post=1623"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}