{"id":112,"date":"2021-01-19T16:08:40","date_gmt":"2021-01-19T07:08:40","guid":{"rendered":"https:\/\/ubuntu.auctionpro.co.kr\/?page_id=112"},"modified":"2023-08-14T18:23:37","modified_gmt":"2023-08-14T09:23:37","slug":"ubuntu-18-04-mysql-%ec%84%a4%ec%b9%98","status":"publish","type":"page","link":"https:\/\/ubuntu.auctionpro.co.kr\/?page_id=112","title":{"rendered":"ubuntu 18.04  mysql \uc124\uce58"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\">1.  sudo apt update<\/h3>\n\n\n\n<h3 class=\"wp-block-heading\">2.  sudo apt install mysql-server<\/h3>\n\n\n\n<h3 class=\"wp-block-heading\">3.  sudo mysql_secure_installation<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted lang:vim decode:true\">sudo apt update\nsudo apt install mysql-server\nsudo mysql_secure_installation<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">4.  sudo mysql_secure_installation<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted lang:vim decode:true\">root@localhost:\/etc\/apache2# sudo mysql_secure_installation\n\nSecuring the MySQL server deployment.\n\nConnecting to MySQL using a blank password.\n\nVALIDATE PASSWORD PLUGIN can be used to test passwords\nand improve security. It checks the strength of password\nand allows the users to set only those passwords which are\nsecure enough. Would you like to setup VALIDATE PASSWORD plugin?\n\nPress y|Y for Yes, any other key for No: y\n\nThere are three levels of password validation policy:\n\nLOW    Length &gt;= 8\nMEDIUM Length &gt;= 8, numeric, mixed case, and special characters\nSTRONG Length &gt;= 8, numeric, mixed case, special characters and dictionary                  file\n\nPlease enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 0\nPlease set the password for root here.\n\nNew password:\n\nRe-enter new password:\n\nEstimated strength of the password: 50\nDo you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y\nBy default, a MySQL installation has an anonymous user,\nallowing anyone to log into MySQL without having to have\na user account created for them. This is intended only for\ntesting, and to make the installation go a bit smoother.\nYou should remove them before moving into a production\nenvironment.\n\nRemove anonymous users? (Press y|Y for Yes, any other key for No) : y\nSuccess.\n\n\nNormally, root should only be allowed to connect from\n'localhost'. This ensures that someone cannot guess at\nthe root password from the network.\n\nDisallow root login remotely? (Press y|Y for Yes, any other key for No) : n\n\n ... skipping.\nBy default, MySQL comes with a database named 'test' that\nanyone can access. This is also intended only for testing,\nand should be removed before moving into a production\nenvironment.\n\n\nRemove test database and access to it? (Press y|Y for Yes, any other key for No) : y\n - Dropping test database...\nSuccess.\n\n - Removing privileges on test database...\nSuccess.\n\nReloading the privilege tables will ensure that all changes\nmade so far will take effect immediately.\n\nReload privilege tables now? (Press y|Y for Yes, any other key for No) : n\n\n ... skipping.\nAll done!\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">5. Check authentication method for MySQL users<\/h3>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:vim decode:true \"> \nroot@localhost:\/etc\/apache2# sudo mysql -uroot -p\nEnter password:\nWelcome to the MySQL monitor.  Commands end with ; or \\g.\nYour MySQL connection id is 4\nServer version: 5.7.30-0ubuntu0.18.04.1 (Ubuntu)\n \nCopyright (c) 2000, 2020, Oracle and\/or its affiliates. All rights reserved.\n \nOracle is a registered trademark of Oracle Corporation and\/or its\naffiliates. Other names may be trademarks of their respective\nowners.\n \nType 'help;' or '\\h' for help. Type '\\c' to clear the current input statement.\n \nmysql&gt; use mysql\nReading table information for completion of table and column names\nYou can turn off this feature to get a quicker startup with -A\n \nDatabase changed\nmysql&gt; SELECT user,host,authentication_string,plugin,host FROM mysql.user;\n+------------------+-----------+-------------------------------------------+-----------------------+-----------+\n| user             | host      | authentication_string                     | plugin                | host      |\n+------------------+-----------+-------------------------------------------+-----------------------+-----------+\n| root             | localhost |                                           | auth_socket           | localhost |\n| mysql.session    | localhost | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | mysql_native_password | localhost |\n| mysql.sys        | localhost | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | mysql_native_password | localhost |\n| debian-sys-maint | localhost | *C93D3360F51BE0E6E42E58C4D7F4853973596949 | mysql_native_password | localhost |\n+------------------+-----------+-------------------------------------------+-----------------------+-----------+\n4 rows in set (0.00 sec)\n \nmysql&gt; ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'StrongPassword';\nQuery OK, 0 rows affected (0.00 sec)\n \nmysql&gt; SELECT user,authentication_string,plugin,host FROM mysql.user;\n+------------------+-------------------------------------------+-----------------------+-----------+\n| user             | authentication_string                     | plugin                | host      |\n+------------------+-------------------------------------------+-----------------------+-----------+\n| root             | *E57EB53ADCB799E5C107333FBBF5429597A509AC | mysql_native_password | localhost |\n| mysql.session    | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | mysql_native_password | localhost |\n| mysql.sys        | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | mysql_native_password | localhost |\n| debian-sys-maint | *C93D3360F51BE0E6E42E58C4D7F4853973596949 | mysql_native_password | localhost |\n+------------------+-------------------------------------------+-----------------------+-----------+\n4 rows in set (0.00 sec)\n \nmysql&gt; FLUSH PRIVILEGES;\nQuery OK, 0 rows affected (0.00 sec)<\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">5.1 host\uac00 % \uc77c \uacbd\uc6b0<\/h3>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:vim decode:true \">mysql&gt; ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'StrongPassword';\nQuery OK, 0 rows affected (0.00 sec)\n<\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">6. \uc218\uc815 bind-address=127.0.0.0<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">vi \/etc\/mysql\/mysql.conf.d\/mysqld.cnf<\/h4>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:vim decode:true \" >bind-address = 0.0.0.0\nmysqlx-bind-address = 0.0.0.0<\/pre><\/div>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:vim decode:true \" >sudo systemctl restart mysql<\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">7. ufw allow \uc5f0\uacb0 \uc124\uc815 Or IPtable Port open<\/h3>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:vim decode:true \">sudo ufw allow from myIP(111.222.333.222) to any port 3306\nsudo ufw reload\n<\/pre><\/div>\n\n\n\n<pre class=\"wp-block-preformatted lang:vim decode:true\">  iptables -A INPUT -p tcp -s myIP(111.222.333.222) --dport 3306 -j ACCEPT\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">8. Mysql WorkBench \uc5f0\uacb0 \ud14c\uc2a4\ud2b8<\/h3>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"787\" height=\"495\" src=\"https:\/\/ubuntu.auctionpro.co.kr\/wp-content\/uploads\/2021\/11\/mysql_Workbench.png\" alt=\"\" class=\"wp-image-349\" srcset=\"https:\/\/ubuntu.auctionpro.co.kr\/wp-content\/uploads\/2021\/11\/mysql_Workbench.png 787w, https:\/\/ubuntu.auctionpro.co.kr\/wp-content\/uploads\/2021\/11\/mysql_Workbench-300x189.png 300w, https:\/\/ubuntu.auctionpro.co.kr\/wp-content\/uploads\/2021\/11\/mysql_Workbench-768x483.png 768w\" sizes=\"auto, (max-width: 787px) 100vw, 787px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">\ucc38\uace0 :  \ud328\uce90\uc9c0\uac00 \uc9c0\uc6d0\uc744 \ud558\uc9c0 \uc54a\ub294 \uacbd\uc6b0<\/h3>\n\n\n\n<h3 class=\"wp-block-heading\">sudo apt install mariadb-server-10.0<\/h3>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:vim decode:true \"> sudo apt install mysql-server\nReading package lists... Done\nBuilding dependency tree... Done\nReading state information... Done\nxc, but is referred to by another package.\nThis may mean that the package is missing, has been obsoleted, or\nis only available from another source\nHowever the following packages replace it:\n  mariadb-server-10.0\n\nE: Package 'mysql-server' has no installation candidate\n\n$ sudo apt install mariadb-server-10.0\n<\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>1. sudo apt update 2. sudo apt install mysql-server 3. sudo mysql_secure_installation sudo apt update sudo apt install mysql-server sudo mysql_secure_installation 4. sudo mysql_secure_installation root@localhost:\/etc\/apache2# sudo mysql_secure_installation Securing the MySQL server deployment. Connecting to MySQL using a blank password. VALIDATE PASSWORD PLUGIN can be used to test passwords and improve security. It checks the strength &hellip;<br \/><a href=\"https:\/\/ubuntu.auctionpro.co.kr\/?page_id=112\" class=\"more-link pen_button pen_element_default pen_icon_arrow_double\"><span class=\"screen-reader-text\">ubuntu 18.04  mysql \uc124\uce58<\/span> \ub354\ubcf4\uae30<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":13,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-112","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/ubuntu.auctionpro.co.kr\/index.php?rest_route=\/wp\/v2\/pages\/112","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ubuntu.auctionpro.co.kr\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/ubuntu.auctionpro.co.kr\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/ubuntu.auctionpro.co.kr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ubuntu.auctionpro.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=112"}],"version-history":[{"count":7,"href":"https:\/\/ubuntu.auctionpro.co.kr\/index.php?rest_route=\/wp\/v2\/pages\/112\/revisions"}],"predecessor-version":[{"id":515,"href":"https:\/\/ubuntu.auctionpro.co.kr\/index.php?rest_route=\/wp\/v2\/pages\/112\/revisions\/515"}],"up":[{"embeddable":true,"href":"https:\/\/ubuntu.auctionpro.co.kr\/index.php?rest_route=\/wp\/v2\/pages\/13"}],"wp:attachment":[{"href":"https:\/\/ubuntu.auctionpro.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=112"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}