{"id":149941,"date":"2024-11-01T15:42:21","date_gmt":"2024-11-01T07:42:21","guid":{"rendered":"https:\/\/server.hk\/cnblog\/149941\/"},"modified":"2024-11-01T15:42:22","modified_gmt":"2024-11-01T07:42:22","slug":"%e5%ae%89%e8%a3%9dmysql%e5%9c%a8linux-as3%e4%b9%8b%e4%b8%8b","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/149941\/","title":{"rendered":"\u5b89\u88ddMySQL\u5728linux as3\u4e4b\u4e0b"},"content":{"rendered":"<h1 id=\"%e5%ae%89%e8%a3%9dmysql%e5%9c%a8linux-as3%e4%b9%8b%e4%b8%8b-CDWMpSmfkR\">\u5b89\u88ddMySQL\u5728Linux AS3\u4e4b\u4e0b<\/h1>\n<p>MySQL\u662f\u4e00\u500b\u6d41\u884c\u7684\u958b\u6e90\u95dc\u806f\u6578\u64da\u5eab\u7ba1\u7406\u7cfb\u7d71\uff0c\u5ee3\u6cdb\u61c9\u7528\u65bc\u5404\u7a2e\u61c9\u7528\u7a0b\u5e8f\u4e2d\u3002\u5c0d\u65bc\u4f7f\u7528Linux AS3\u7684\u7528\u6236\u4f86\u8aaa\uff0c\u5b89\u88ddMySQL\u662f\u4e00\u500b\u76f8\u5c0d\u7c21\u55ae\u7684\u904e\u7a0b\u3002\u672c\u6587\u5c07\u8a73\u7d30\u4ecb\u7d39\u5982\u4f55\u5728Linux AS3\u74b0\u5883\u4e2d\u5b89\u88ddMySQL\uff0c\u4e26\u63d0\u4f9b\u4e00\u4e9b\u57fa\u672c\u7684\u914d\u7f6e\u548c\u4f7f\u7528\u5efa\u8b70\u3002<\/p>\n<h2 id=\"%e5%89%8d%e6%9c%9f%e6%ba%96%e5%82%99-CDWMpSmfkR\">\u524d\u671f\u6e96\u5099<\/h2>\n<p>\u5728\u958b\u59cb\u5b89\u88dd\u4e4b\u524d\uff0c\u8acb\u78ba\u4fdd\u60a8\u7684\u7cfb\u7d71\u5df2\u7d93\u66f4\u65b0\u5230\u6700\u65b0\u7248\u672c\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u4f86\u66f4\u65b0\u7cfb\u7d71\uff1a<\/p>\n<pre><code>sudo yum update<\/code><\/pre>\n<p>\u6b64\u5916\uff0c\u60a8\u9700\u8981\u78ba\u4fdd\u60a8\u7684\u7cfb\u7d71\u4e0a\u5df2\u7d93\u5b89\u88dd\u4e86\u5fc5\u8981\u7684\u4f9d\u8cf4\u5305\u3002\u9019\u4e9b\u4f9d\u8cf4\u5305\u901a\u5e38\u5305\u62ecgcc\u3001make\u7b49\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u4f86\u5b89\u88dd\u9019\u4e9b\u4f9d\u8cf4\u5305\uff1a<\/p>\n<pre><code>sudo yum install gcc make<\/code><\/pre>\n<h2 id=\"%e4%b8%8b%e8%bc%89mysql-CDWMpSmfkR\">\u4e0b\u8f09MySQL<\/h2>\n<p>\u63a5\u4e0b\u4f86\uff0c\u60a8\u9700\u8981\u5f9eMySQL\u7684\u5b98\u65b9\u7db2\u7ad9\u4e0b\u8f09\u6700\u65b0\u7248\u672c\u7684MySQL\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528wget\u547d\u4ee4\u4f86\u4e0b\u8f09MySQL\u7684RPM\u5305\u3002\u4f8b\u5982\uff1a<\/p>\n<pre><code>wget https:\/\/dev.mysql.com\/get\/mysql57-community-release-el7-11.noarch.rpm<\/code><\/pre>\n<p>\u4e0b\u8f09\u5b8c\u6210\u5f8c\uff0c\u60a8\u9700\u8981\u5b89\u88dd\u9019\u500bRPM\u5305\uff1a<\/p>\n<pre><code>sudo rpm -ivh mysql57-community-release-el7-11.noarch.rpm<\/code><\/pre>\n<h2 id=\"%e5%ae%89%e8%a3%9dmysql-CDWMpSmfkR\">\u5b89\u88ddMySQL<\/h2>\n<p>\u73fe\u5728\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528yum\u547d\u4ee4\u4f86\u5b89\u88ddMySQL\u3002\u57f7\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre><code>sudo yum install mysql-server<\/code><\/pre>\n<p>\u5b89\u88dd\u904e\u7a0b\u4e2d\uff0c\u7cfb\u7d71\u6703\u63d0\u793a\u60a8\u78ba\u8a8d\u5b89\u88dd\uff0c\u8acb\u8f38\u5165\u201cy\u201d\u4ee5\u7e7c\u7e8c\u3002<\/p>\n<h2 id=\"%e5%95%9f%e5%8b%95mysql%e6%9c%8d%e5%8b%99-CDWMpSmfkR\">\u555f\u52d5MySQL\u670d\u52d9<\/h2>\n<p>\u5b89\u88dd\u5b8c\u6210\u5f8c\uff0c\u60a8\u9700\u8981\u555f\u52d5MySQL\u670d\u52d9\u3002\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u4f86\u555f\u52d5MySQL\uff1a<\/p>\n<pre><code>sudo systemctl start mysqld<\/code><\/pre>\n<p>\u70ba\u4e86\u78ba\u4fddMySQL\u5728\u7cfb\u7d71\u555f\u52d5\u6642\u81ea\u52d5\u555f\u52d5\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre><code>sudo systemctl enable mysqld<\/code><\/pre>\n<h2 id=\"%e9%85%8d%e7%bd%aemysql-CDWMpSmfkR\">\u914d\u7f6eMySQL<\/h2>\n<p>\u5b89\u88ddMySQL\u5f8c\uff0c\u60a8\u9700\u8981\u9032\u884c\u4e00\u4e9b\u57fa\u672c\u914d\u7f6e\u3002\u9996\u5148\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u4f86\u7372\u53d6MySQL\u7684\u81e8\u6642\u5bc6\u78bc\uff1a<\/p>\n<pre><code>sudo grep 'temporary password' \/var\/log\/mysqld.log<\/code><\/pre>\n<p>\u63a5\u4e0b\u4f86\uff0c\u4f7f\u7528\u9019\u500b\u81e8\u6642\u5bc6\u78bc\u767b\u9304MySQL\uff1a<\/p>\n<pre><code>mysql -u root -p<\/code><\/pre>\n<p>\u7cfb\u7d71\u6703\u63d0\u793a\u60a8\u8f38\u5165\u5bc6\u78bc\uff0c\u8acb\u8f38\u5165\u525b\u624d\u7372\u53d6\u7684\u81e8\u6642\u5bc6\u78bc\u3002\u767b\u9304\u5f8c\uff0c\u5efa\u8b70\u60a8\u7acb\u5373\u66f4\u6539root\u7528\u6236\u7684\u5bc6\u78bc\uff1a<\/p>\n<pre><code>ALTER USER 'root'@'localhost' IDENTIFIED BY '\u65b0\u5bc6\u78bc';<\/code><\/pre>\n<h2 id=\"%e5%9f%ba%e6%9c%ac%e6%93%8d%e4%bd%9c-CDWMpSmfkR\">\u57fa\u672c\u64cd\u4f5c<\/h2>\n<p>\u5728\u6210\u529f\u5b89\u88dd\u548c\u914d\u7f6eMySQL\u5f8c\uff0c\u60a8\u53ef\u4ee5\u958b\u59cb\u5275\u5efa\u6578\u64da\u5eab\u548c\u7528\u6236\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u57fa\u672c\u7684\u64cd\u4f5c\u793a\u4f8b\uff1a<\/p>\n<ul>\n<li>\u5275\u5efa\u6578\u64da\u5eab\uff1a<\/li>\n<pre><code>CREATE DATABASE mydatabase;<\/code><\/pre>\n<li>\u5275\u5efa\u7528\u6236\uff1a<\/li>\n<pre><code>CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'mypassword';<\/code><\/pre>\n<li>\u6388\u6b0a\u7528\u6236\u8a2a\u554f\u6578\u64da\u5eab\uff1a<\/li>\n<pre><code>GRANT ALL PRIVILEGES ON mydatabase.* TO 'myuser'@'localhost';<\/code><\/pre>\n<li>\u5237\u65b0\u6b0a\u9650\uff1a<\/li>\n<pre><code>FLUSH PRIVILEGES;<\/code><\/pre>\n<\/ul>\n<h2 id=\"%e7%b8%bd%e7%b5%90-CDWMpSmfkR\">\u7e3d\u7d50<\/h2>\n<p>\u5728\u672c\u6587\u4e2d\uff0c\u6211\u5011\u4ecb\u7d39\u4e86\u5982\u4f55\u5728Linux AS3\u74b0\u5883\u4e2d\u5b89\u88dd\u548c\u914d\u7f6eMySQL\u3002\u9019\u4e9b\u6b65\u9a5f\u5305\u62ec\u7cfb\u7d71\u66f4\u65b0\u3001\u4e0b\u8f09MySQL\u3001\u5b89\u88dd\u670d\u52d9\u3001\u555f\u52d5\u670d\u52d9\u4ee5\u53ca\u57fa\u672c\u7684\u6578\u64da\u5eab\u64cd\u4f5c\u3002\u900f\u904e\u9019\u4e9b\u6b65\u9a5f\uff0c\u60a8\u53ef\u4ee5\u8f15\u9b06\u5730\u5728\u60a8\u7684\u4f3a\u670d\u5668\u4e0a\u8a2d\u7f6eMySQL\u6578\u64da\u5eab\uff0c\u70ba\u60a8\u7684\u61c9\u7528\u7a0b\u5e8f\u63d0\u4f9b\u652f\u6301\u3002\u5982\u679c\u60a8\u9700\u8981\u66f4\u9ad8\u6548\u7684\u89e3\u6c7a\u65b9\u6848\uff0c\u8003\u616e\u4f7f\u7528<a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a>\u4f86\u904b\u884c\u60a8\u7684MySQL\u670d\u52d9\uff0c\u9019\u5c07\u70ba\u60a8\u63d0\u4f9b\u66f4\u597d\u7684\u6027\u80fd\u548c\u7a69\u5b9a\u6027\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5b89\u88ddMySQL\u5728Linux AS3\u4e0b\u7684\u8a73\u7d30\u6b65\u9a5f\uff0c\u5e6b\u52a9\u60a8\u8f15\u9b06\u8a2d\u7f6e\u548c\u914d\u7f6e\u6578\u64da\u5eab\u74b0\u5883\u3002<\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-149941","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/149941","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=149941"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/149941\/revisions"}],"predecessor-version":[{"id":149942,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/149941\/revisions\/149942"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=149941"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=149941"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=149941"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}