{"id":5489,"date":"2024-01-24T17:07:29","date_gmt":"2024-01-24T08:07:29","guid":{"rendered":"https:\/\/www.searchlight8.com\/?p=5489"},"modified":"2024-01-24T17:10:09","modified_gmt":"2024-01-24T08:10:09","slug":"mysql-ubuntu-for-ubuntu","status":"publish","type":"post","link":"https:\/\/www.searchlight8.com\/wp-searchlight8\/mysql-ubuntu-for-ubuntu\/","title":{"rendered":"[MySQL] Ubuntu\u3067\u306e\u74b0\u5883\u69cb\u7bc9"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\">MySQL\u306e\u30a2\u30f3\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h3>\n\n\n\n<p>\u65e2\u306bMySQL\u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u308b\u5834\u5408\u306f\u30bf\u30fc\u30df\u30ca\u30eb\u304b\u3089\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u30a2\u30f3\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:default decode:true \">sudo apt remove --purge mysql-server* mysql-common\nsudo apt autoremove --purge\nsudo rm -r \/etc\/mysql\nsudo rm -r \/var\/lib\/mysql<\/pre><\/div>\n\n\n\n<p>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u308b\u30d0\u30fc\u30b8\u30e7\u30f3\u306e\u78ba\u8a8d\u3002<\/p>\n\n\n\n<p>No such file or directory\u3068\u8868\u793a\u3055\u308c\u308c\u3070\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u306a\u3044\u72b6\u614b\u3067\u3059\u3002<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:default decode:true \">$ mysql --version\nbash: \/usr\/bin\/mysql: No such file or directory<\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">apt update<\/h3>\n\n\n\n<p>\u6700\u65b0\u306eMySQL\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u305f\u3081 apt update \u3092\u884c\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:default decode:true \">$ sudo apt update<\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">mysql-server\u30d1\u30b1\u30fc\u30b8\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h3>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:default decode:true \">$ sudo apt install mysql-server<\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">MySQL\u306e\u8a2d\u5b9a<\/h3>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:default decode:true \">$ sudo mysql_secure_installation<\/pre><\/div>\n\n\n\n<p>\u4e0b\u8a18\u306e\u3088\u3046\u306a\u6587\u7ae0\u304c\u8868\u793as\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:default decode:true \">Securing the MySQL server deployment.\n\nConnecting to MySQL using a blank password.\n\nVALIDATE PASSWORD COMPONENT 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 component?\n\nPress y|Y for Yes, any other key for No: <\/pre><\/div>\n\n\n\n<p>VALIDATE PASSWORD COMPONENT \u3092\u4f7f\u7528\u3057\u3066\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u30c6\u30b9\u30c8\u3067\u304d\u307e\u3059<br>\u305d\u3057\u3066\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u3092\u5411\u4e0a\u3055\u305b\u307e\u3059\u3002 \u30d1\u30b9\u30ef\u30fc\u30c9\u306e\u5f37\u5ea6\u3092\u30c1\u30a7\u30c3\u30af\u3057\u307e\u3059<br>\u30e6\u30fc\u30b6\u30fc\u306f\u3001\u6b21\u306e\u30d1\u30b9\u30ef\u30fc\u30c9\u306e\u307f\u3092\u8a2d\u5b9a\u3067\u304d\u307e\u3059\u3002<br>\u5341\u5206\u306b\u5b89\u5168\u3067\u3059\u3002 VALIDATE PASSWORD \u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u3057\u307e\u3059\u304b?<\/p>\n\n\n\n<p>\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u4f7f\u3044\u305f\u3044\u306e\u3067\u300cY\u300d\u3092\u5165\u529b\u3057Enterkey\u3092\u62bc\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u6b21\u306f\u30d1\u30b9\u30ef\u30fc\u30c9\u306e\u5f37\u5ea6\u306e\u8a2d\u5b9a\u3092\u805e\u304b\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:default decode:true \">There 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: <\/pre><\/div>\n\n\n\n<p>\u4eca\u56de\u306f\u30c6\u30b9\u30c8\u904b\u7528\u3067\u7c21\u5358\u306a\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u5229\u7528\u3057\u305f\u3044\u306e\u3067\u300c\uff10\u300d\u3092\u9078\u629e\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u3053\u306e\u5f8c\u306bRoot\u306e\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u8a2d\u5b9a\u3059\u308b\u8cea\u554f\u304c\u6765\u308b\u306e\u3067\u3059\u304c\u3001Ubuntu\u306e\u5834\u5408\u30c7\u30d5\u30a9\u30eb\u30c8\u3067auth_socket\uff08\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u4f7f\u308f\u306a\u3044\u30ed\u30b0\u30a4\u30f3\uff09\u304c\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u308b\u306e\u3067Root\u306e\u30d1\u30b9\u30ef\u30fc\u30c9\u8a2d\u5b9a\u306f\u805e\u304b\u308c\u307e\u305b\u3093\u3002<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:default decode:true \">Skipping password set for root as authentication with auth_socket is used by default.\nIf you would like to use password authentication instead, this can be done with the \"ALTER_USER\" command.\nSee https:\/\/dev.mysql.com\/doc\/refman\/8.0\/en\/alter-user.html#alter-user-password-management for more information.\n\n<\/pre><\/div>\n\n\n\n<p>\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306f auth_socket \u306b\u3088\u308b\u8a8d\u8a3c\u304c\u4f7f\u7528\u3055\u308c\u308b\u305f\u3081\u3001root \u306b\u8a2d\u5b9a\u3055\u308c\u305f\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u30b9\u30ad\u30c3\u30d7\u3057\u307e\u3059\u3002<br>\u4ee3\u308f\u308a\u306b\u30d1\u30b9\u30ef\u30fc\u30c9\u8a8d\u8a3c\u3092\u4f7f\u7528\u3057\u305f\u3044\u5834\u5408\u306f\u3001\u300cALTER_USER\u300d\u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u7528\u3057\u3066\u5b9f\u884c\u3067\u304d\u307e\u3059\u3002<br>\u8a73\u7d30\u306b\u3064\u3044\u3066\u306f\u3001https:\/\/dev.mysql.com\/doc\/refman\/8.0\/en\/alter-user.html#alter-user-password-management \u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:default decode:true \">By 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) : <\/pre><\/div>\n\n\n\n<p>\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306f\u3001MySQL \u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306b\u306f\u533f\u540d\u30e6\u30fc\u30b6\u30fc\u304c\u5b58\u5728\u3057\u307e\u3059\u3002<br>\u3092\u6301\u305f\u306a\u304f\u3066\u3082\u8ab0\u3067\u3082 MySQL \u306b\u30ed\u30b0\u30a4\u30f3\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b<br>\u5f7c\u3089\u306e\u305f\u3081\u306b\u4f5c\u6210\u3055\u308c\u305f\u30e6\u30fc\u30b6\u30fc\u30a2\u30ab\u30a6\u30f3\u30c8\u3002 \u3053\u308c\u306f\u6b21\u306e\u76ee\u7684\u306e\u307f\u3092\u5bfe\u8c61\u3068\u3057\u3066\u3044\u307e\u3059\u3002<br>\u30c6\u30b9\u30c8\u3092\u884c\u3044\u3001\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3092\u5c11\u3057\u30b9\u30e0\u30fc\u30ba\u306b\u884c\u3046\u305f\u3081\u3067\u3059\u3002<br>\u672c\u756a\u74b0\u5883\u306b\u79fb\u884c\u3059\u308b\u524d\u306b\u305d\u308c\u3089\u3092\u524a\u9664\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u4e0d\u8981\u306aanonymous\u30e6\u30fc\u30b6\u30fc\u3092\u6d88\u3059\u304b\u3069\u3046\u304b\u805e\u304b\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<p><br><\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:default decode:true \">Remove anonymous users? (Press y|Y for Yes, any other key for No) : <\/pre><\/div>\n\n\n\n<p>\u4e0d\u8981\u306a\u30e6\u30fc\u30b6\u30fc\u3092\u6d88\u3059\u306e\u3067\u300cY\u300d\u3092\u9078\u629e\u3057\u3001Enterkey\u3092\u62bc\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p><\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:default decode:true \">ormally, 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) : <\/pre><\/div>\n\n\n\n<p>\u901a\u5e38\u3001root \u306b\u306f\u6b21\u304b\u3089\u306e\u63a5\u7d9a\u306e\u307f\u3092\u8a31\u53ef\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<br>\u3053\u308c\u306b\u3088\u308a\u3001\u8ab0\u304b\u304c\u63a8\u6e2c\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u306a\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u30ea\u30e2\u30fc\u30c8\u304b\u3089\u306e\u30eb\u30fc\u30c8\u3067\u306e\u30ed\u30b0\u30a4\u30f3\u3092\u7981\u6b62\u3057\u307e\u3059\u304b\uff1f\u3068\u805e\u304b\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u4eca\u56de\u306f\u5916\u90e8\u304b\u3089\u63a5\u7d9a\u3057\u306a\u3044\u306e\u3067\u300cY\u300d\u3092\u9078\u629e\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p><br><\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:default decode:true \">By 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) : <\/pre><\/div>\n\n\n\n<p>\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306f\u3001MySQL \u306b\u306f\u300ctest\u300d\u3068\u3044\u3046\u540d\u524d\u306e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u304c\u4ed8\u5c5e\u3057\u3066\u3044\u307e\u3059\u3002<br>\u8ab0\u3067\u3082\u30a2\u30af\u30bb\u30b9\u3067\u304d\u307e\u3059\u3002 \u3053\u308c\u3082\u30c6\u30b9\u30c8\u306e\u307f\u3092\u76ee\u7684\u3068\u3057\u3066\u3044\u307e\u3059\u304c\u3001<br>\u672c\u756a\u74b0\u5883\u306b\u79fb\u884c\u3059\u308b\u524d\u306b\u524a\u9664\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u524a\u9664\u3057\u307e\u3059\u304b\uff1f\u3068\u805e\u304b\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u524a\u9664\u3057\u305f\u3044\u306e\u3067\u300cY\u300d\u3092\u9078\u629e\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:default decode:true \">Reloading 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) : <\/pre><\/div>\n\n\n\n<p>\u6a29\u9650\u30c6\u30fc\u30d6\u30eb\u3092\u518d\u30ed\u30fc\u30c9\u3059\u308b\u3068\u3001\u3059\u3079\u3066\u306e\u5909\u66f4\u304c\u78ba\u5b9f\u306b\u53cd\u6620\u3055\u308c\u307e\u3059\u3002<br>\u305d\u308c\u307e\u3067\u306b\u4f5c\u6210\u3057\u305f\u5185\u5bb9\u306f\u3059\u3050\u306b\u6709\u52b9\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u8a2d\u5b9a\u3092\u6709\u52b9\u306b\u3057\u305f\u3044\u306e\u3067\u300cY\u300d\u3092\u9078\u629e\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u3053\u308c\u3067MySQL\u306e\u8a2d\u5b9a\u304c\u5b8c\u4e86\u3057\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">MySQL\u306b\u30ed\u30b0\u30a4\u30f3<\/h3>\n\n\n\n<p>Ubuntu\u306e\u5834\u5408\u306f\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u30eb\u30fc\u30c8\u3067\u306e\u30d1\u30b9\u30ef\u30fc\u30c9\u30ed\u30b0\u30a4\u30f3\u304c\u7981\u6b62\u3068\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p>$ sudo mysql \u3092\u5b9f\u884c\u3059\u308b\u3068Ubuntu\u3067\u306e\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u805e\u304b\u308c\u307e\u3059\u3002\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u5165\u529b\u3059\u308b\u3068MySQL\u306b\u5165\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:mysql decode:true \">$ sudo mysql\n[sudo] password for username: \nWelcome to the MySQL monitor.  Commands end with ; or \\g.\nYour MySQL connection id is 10\nServer version: 8.0.35-0ubuntu0.22.04.1 (Ubuntu)\n\nCopyright (c) 2000, 2023, Oracle and\/or its affiliates.\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; <\/pre><\/div>\n\n\n\n<p>\u8a66\u3057\u306broot\u3067\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u4f7f\u3063\u3066\u30ed\u30b0\u30a4\u30f3\u3057\u3088\u3046\u3068\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:default decode:true \">$ mysql -u root -p\nEnter password: \nERROR 1698 (28000): Access denied for user 'root'@'localhost<\/pre><\/div>\n\n\n\n<p>\u3053\u306e\u3088\u3046\u306b\u63a5\u7d9a\u304c\u62d2\u5426\u3055\u308c\u307e\u3059\u3002Ubuntu\u306eMySQL\u304c\u300c\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u30eb\u30fc\u30c8\u3067\u306e\u30d1\u30b9\u30ef\u30fc\u30c9\u30ed\u30b0\u30a4\u30f3\u304c\u7981\u6b62\u300d\u3068\u3044\u3046\u4ed5\u7d44\u307f\u3092\u77e5\u3089\u306a\u3044\u3068\u30cf\u30de\u308a\u307e\u3059\u306d\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u30d1\u30b9\u30ef\u30fc\u30c9\u691c\u8a3c\u30dd\u30ea\u30b7\u30fc\u306e\u8868\u793a<\/h3>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:mysql decode:true \">mysql&gt; SHOW VARIABLES LIKE 'validate_password%';\n+-------------------------------------------------+-------+\n| Variable_name                                   | Value |\n+-------------------------------------------------+-------+\n| validate_password.changed_characters_percentage | 0     |\n| validate_password.check_user_name               | ON    |\n| validate_password.dictionary_file               |       |\n| validate_password.length                        | 8     |\n| validate_password.mixed_case_count              | 1     |\n| validate_password.number_count                  | 1     |\n| validate_password.policy                        | LOW   |\n| validate_password.special_char_count            | 1     |\n+-------------------------------------------------+-------+\n8 rows in set (0.00 sec)<\/pre><\/div>\n\n\n\n<h4 class=\"wp-block-heading\">MySQL\u30e6\u30fc\u30b6\u30fc\u306e\u8868\u793a<\/h4>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:mysql decode:true \">mysql&gt; SELECT user, host FROM mysql.user;\n+------------------+-----------+\n| user             | host      |\n+------------------+-----------+\n| debian-sys-maint | localhost |\n| mysql.infoschema | localhost |\n| mysql.session    | localhost |\n| mysql.sys        | localhost |\n| root             | localhost |\n+------------------+-----------+<\/pre><\/div>\n\n\n\n<h4 class=\"wp-block-heading\">MySQL\u30e6\u30fc\u30b6\u30fc\u8a8d\u8a3c\u60c5\u5831\u306e\u8868\u793a<\/h4>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"wrap:false lang:mysql decode:true \">mysql&gt; SELECT user,authentication_string,plugin,host FROM mysql.user;\n+------------------+------------------------------------------------------------------------+-----------------------+-----------+\n| user             | authentication_string                                                  | plugin                | host      |\n+------------------+------------------------------------------------------------------------+-----------------------+-----------+\n| debian-sys-maint | $A$005$L|\/?c8ohX%e:]WTu5nnUoZId9OSqu.ubi2d6KU3qSn09f6sqokrW3AeV9 | caching_sha2_password | localhost |\n| mysql.infoschema | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED | caching_sha2_password | localhost |\n| mysql.session    | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED | caching_sha2_password | localhost |\n| mysql.sys        | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED | caching_sha2_password | localhost |\n| root             |                                                                        | auth_socket           | localhost |\n+------------------+------------------------------------------------------------------------+-----------------------+-----------+<\/pre><\/div>\n\n\n\n<p>\u3053\u3053\u3067\u30eb\u30fc\u30c8\u3060\u3051\u304cauth_socket\u3092\u4f7f\u3063\u3066\u306e\u8a8d\u8a3c\u3068\u3044\u3046\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3059\u3002\u4ed6\u306f\u300ccaching_sha2_password\u300d\u3067\u306e\u30d1\u30b9\u30ef\u30fc\u30c9\u8a8d\u8a3c\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">MySQL\u30e6\u30fc\u30b6\u30fc\u306e\u4f5c\u6210<\/h3>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:mysql decode:true \">mysql &gt; CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';<\/pre><\/div>\n\n\n\n<h4 class=\"wp-block-heading\">Database\u306e\u4f5c\u6210<\/h4>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:default decode:true \">mysql &gt; CREATE DATABASE databasename;<\/pre><\/div>\n\n\n\n<h4 class=\"wp-block-heading\">\u30e6\u30fc\u30b6\u30fc\u306e\u4f5c\u6210<\/h4>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:mysql decode:true \">mysql&gt; show grants for 'you'@'localhost';\n+----------------------------------------+\n| Grants for you@localhost                |\n+----------------------------------------+\n| GRANT USAGE ON *.* TO `you`@`localhost` |\n+----------------------------------------+<\/pre><\/div>\n\n\n\n<p>\u4f5c\u3063\u305f\u3070\u304b\u308a\u306e\u30e6\u30fc\u30b6\u30fc\u306e\u6a29\u9650\u3092\u898b\u3066\u307f\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u300cGRANT USAGE ON *.* TO `\u30e6\u30fc\u30b6\u30fc\u540d`&nbsp;\u300d\u3068\u8868\u793a\u3055\u308c\u3066\u304a\u308a\u3001\u30e6\u30fc\u30b6\u30fc\u306b\u6a29\u9650\u304c\u4e0e\u3048\u3089\u308c\u3066\u3044\u308b\u3088\u3046\u306b\u611f\u3058\u307e\u3059\u304c\u3001\u3001\u3001<\/p>\n\n\n\n<p>\u3053\u308c\u306f\u300c\u4f55\u3082\u6a29\u9650\u304c\u4e0e\u3048\u3089\u308c\u3066\u3044\u306a\u3044\u300d\u3068\u3044\u3046\u610f\u5473\u3067\u3059\u3002\u6a29\u9650\u306e\u7121\u3044\u6a29\u9650\u3092\u4e0e\u3048\u3089\u308c\u3066\u3044\u308b\u3068\u3044\u3046\u3053\u3068\u3067\u3059\u306d\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">\u30e6\u30fc\u30b6\u30fc\u306b\u6a29\u9650\u3092\u4e0e\u3048\u308b<\/h4>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:mysql decode:true \">mysql &gt; grant all on *.* to username@localhost;<\/pre><\/div>\n\n\n\n<p>\u3053\u308c\u3067\u5168\u3066\u306e\u6a29\u9650\u3092\u4e0e\u3048\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u300cshow grants for &#8216;you&#8217;@&#8217;localhost&#8217;;\u300d\u3067\u5185\u5bb9\u3092\u898b\u308b\u3068\u305f\u304f\u3055\u3093\u306e\u6a29\u9650\u304c\u4e0e\u3048\u3089\u308c\u3066\u3044\u308b\u306e\u304c\u308f\u304b\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u30a8\u30e9\u30fc\u5bfe\u51e6<\/h3>\n\n\n\n<p>Django\u3067MySQL\u306b\u63a5\u7d9a\u3057\u3088\u3046\u3068\u3057\u305f\u3089\u6b21\u306e\u3088\u3046\u306a\u30a8\u30e9\u30fc\u304c\u51fa\u307e\u3057\u305f\u3002\u3053\u308c\u306f\u65b0\u3057\u304f\u30e6\u30fc\u30b6\u30fc\u3092\u4f5c\u3063\u305f\u3060\u3051\u3067\u63a5\u7d9a\u3057\u3088\u3046\u3068\u3057\u305f\u5834\u5408\u306e\u4f8b\u3067\u3059\u3002grant all on \u3067\u6a29\u9650\u3092\u4e0e\u3048\u305f\u3089\u63a5\u7d9a\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:default decode:true \">pymysql.err.OperationalError: (1044, \"Access denied for user 'you'@'localhost' to database 'testk'\")<\/pre><\/div>\n\n\n\n<p><\/p>\n\n\n\n<p>\uff08\u53c2\u8003\u30b5\u30a4\u30c8\uff09<\/p>\n\n\n\n<p><a href=\"https:\/\/www.digitalocean.com\/community\/tutorials\/how-to-install-mysql-on-ubuntu-20-04-ja\" data-type=\"link\" data-id=\"https:\/\/www.digitalocean.com\/community\/tutorials\/how-to-install-mysql-on-ubuntu-20-04-ja\">DigitalOcean Ubuntu 20.04\u306bMySQL\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u65b9\u6cd5<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>MySQL\u306e\u30a2\u30f3\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb \u65e2\u306bMyS&#8230;<\/p>\n","protected":false},"author":1,"featured_media":2897,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15,422],"tags":[94,435],"class_list":["post-5489","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-mysql","category-ubuntu","tag-mysql","tag-ubuntu","wpcat-15-id","wpcat-422-id"],"_links":{"self":[{"href":"https:\/\/www.searchlight8.com\/wp-searchlight8\/wp-json\/wp\/v2\/posts\/5489","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.searchlight8.com\/wp-searchlight8\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.searchlight8.com\/wp-searchlight8\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.searchlight8.com\/wp-searchlight8\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.searchlight8.com\/wp-searchlight8\/wp-json\/wp\/v2\/comments?post=5489"}],"version-history":[{"count":35,"href":"https:\/\/www.searchlight8.com\/wp-searchlight8\/wp-json\/wp\/v2\/posts\/5489\/revisions"}],"predecessor-version":[{"id":5524,"href":"https:\/\/www.searchlight8.com\/wp-searchlight8\/wp-json\/wp\/v2\/posts\/5489\/revisions\/5524"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.searchlight8.com\/wp-searchlight8\/wp-json\/wp\/v2\/media\/2897"}],"wp:attachment":[{"href":"https:\/\/www.searchlight8.com\/wp-searchlight8\/wp-json\/wp\/v2\/media?parent=5489"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.searchlight8.com\/wp-searchlight8\/wp-json\/wp\/v2\/categories?post=5489"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.searchlight8.com\/wp-searchlight8\/wp-json\/wp\/v2\/tags?post=5489"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}