|
3 | 3 | <a xmlns="" href="//netkiller.github.io/">简体中文</a> | |
4 | 4 | <a xmlns="" href="http://netkiller.sourceforge.net/">繁体中文</a> | |
5 | 5 | <a xmlns="" href="/journal/index.html">杂文</a> | |
| 6 | + <a xmlns="" href="https://github.com/netkiller">Github</a> | |
6 | 7 | <a xmlns="" href="https://zhuanlan.zhihu.com/netkiller">知乎专栏</a> | |
7 | 8 | <a xmlns="" href="https://edu.51cto.com/lecturer/1703915.html">51CTO学院</a> | |
8 | 9 | <a xmlns="" href="https://edu.csdn.net/lecturer/6423">CSDN程序员研修院</a> | |
9 | | - <a xmlns="" href="https://github.com/netkiller">Github</a> | |
10 | 10 | <a xmlns="" href="http://my.oschina.net/neochen/">OSChina 博客</a> | |
11 | 11 | <a xmlns="" href="https://cloud.tencent.com/developer/column/2078">腾讯云社区</a> | |
12 | 12 | <a xmlns="" href="https://yq.aliyun.com/u/netkiller/">阿里云栖社区</a> | |
|
16 | 16 | <a xmlns="" href="//www.netkiller.cn/home/donations.html">打赏(Donations)</a> | |
17 | 17 | <a xmlns="" href="//www.netkiller.cn/home/about.html">About</a><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">3.2. RDS MySQL</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch03.html">上一页</a> </td><th width="60%" align="center">第 3 章 阿里云</th><td width="20%" align="right"> <a accesskey="n" href="日志服务.html">下一页</a></td></tr></table><hr /></div><table xmlns=""><tr><td><iframe src="//ghbtns.com/github-btn.html?user=netkiller&repo=netkiller.github.io&type=watch&count=true&size=large" height="30" width="170" frameborder="0" scrolling="0" style="width:170px; height: 30px;" allowTransparency="true"></iframe></td><td><iframe src="//ghbtns.com/github-btn.html?user=netkiller&repo=netkiller.github.io&type=fork&count=true&size=large" height="30" width="170" frameborder="0" scrolling="0" style="width:170px; height: 30px;" allowTransparency="true"></iframe></td><td><iframe src="//ghbtns.com/github-btn.html?user=netkiller&type=follow&count=true&size=large" height="30" width="240" frameborder="0" scrolling="0" style="width:240px; height: 30px;" allowTransparency="true"></iframe></td><td></td><td><a href="https://zhuanlan.zhihu.com/netkiller"><img src="/images/logo/zhihu-card-default.svg" height="25" /></a></td><td valign="middle"><a href="https://zhuanlan.zhihu.com/netkiller">知乎专栏</a> | <a href="https://www.zhihu.com/club/1241768772601950208">多维度架构</a></td><td></td><td></td><td></td><td></td></tr></table><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="RDS"></a>3.2. RDS MySQL</h2></div></div></div> |
18 | 18 |
|
19 | | - <div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="idm67338709216"></a>3.2.1. RDS MySQL => 本地 MySQL 数据库</h3></div></div></div> |
| 19 | + <div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="idm317397663248"></a>3.2.1. RDS MySQL => 本地 MySQL 数据库</h3></div></div></div> |
20 | 20 |
|
21 | 21 | <p>从 RDS 上下载的物理备份</p> |
22 | 22 | <pre class="screen"> |
|
25 | 25 | hins19648946_data_20220913035432_qp.xb |
26 | 26 |
|
27 | 27 | </pre> |
28 | | - <div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="idm67338705872"></a>3.2.1.1. MySQL 5.7</h4></div></div></div> |
| 28 | + <div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="idm317397659616"></a>3.2.1.1. MySQL 5.7</h4></div></div></div> |
29 | 29 |
|
30 | 30 | <p>安装依赖库</p> |
31 | 31 | <pre class="screen"> |
|
80 | 80 | </pre> |
81 | 81 | <p>去掉 --skip-grant-tables 选项,重启 MySQL,恢复完成。</p> |
82 | 82 | </div> |
83 | | - <div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="idm67338705616"></a>3.2.1.2. MySQL 8.0</h4></div></div></div> |
| 83 | + <div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="idm317397659360"></a>3.2.1.2. MySQL 8.0</h4></div></div></div> |
84 | 84 |
|
85 | 85 | <p>安装 percona-xtrabackup 恢复软件</p> |
86 | 86 | <pre class="screen"> |
|
103 | 103 | </pre> |
104 | 104 | </div> |
105 | 105 | </div> |
106 | | - <div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="idm67338695376"></a>3.2.2. 换表升级</h3></div></div></div> |
| 106 | + <div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="idm317397649184"></a>3.2.2. 换表升级</h3></div></div></div> |
107 | 107 |
|
108 | 108 | <p>当前表改名,然后再基于旧表创建新的空表</p> |
109 | 109 | <pre class="screen"> |
|
118 | 118 | ALTER TABLE old_table_name RENAME TO new_table_name; |
119 | 119 | CREATE TABLE old_table_name SELECT * FROM new_table_name WHERE ...; |
120 | 120 |
|
| 121 | + </pre> |
| 122 | + </div> |
| 123 | + <div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="idm317397646624"></a>3.2.3. 导出 CSV 文件</h3></div></div></div> |
| 124 | + |
| 125 | + <p>RDS 目前没有找到导出 csv 的方案,客服让使用 DMS 中的数据导出功能</p> |
| 126 | + <pre class="screen"> |
| 127 | + |
| 128 | +mysql> show grants for 'root'@'%'; |
| 129 | ++------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ |
| 130 | +| Grants for root@% | |
| 131 | ++------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ |
| 132 | +| GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, PROCESS, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER ON *.* TO 'root'@'%' IDENTIFIED BY PASSWORD '*F5200743F6F42815CB2DC833C98D6E7730F8E2E2' WITH GRANT OPTION | |
| 133 | ++------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ |
| 134 | +1 row in set (0.00 sec) |
| 135 | + |
| 136 | + </pre> |
| 137 | + <p>查询未找到 FILE 权限,官网权限列表中也没有 https://help.aliyun.com/document_detail/146395.html</p> |
| 138 | + <pre class="screen"> |
| 139 | + |
| 140 | +mysql> GRANT FILE ON *.* to neo@'%' identified by 'chen'; |
| 141 | +Query OK, 0 rows affected (0.026 sec) |
| 142 | + |
| 143 | + |
| 144 | + </pre> |
| 145 | + <p>secure_file_priv 只要不是 null 即可,阿里云配置是 secure_file_priv = ''。</p> |
| 146 | + <pre class="screen"> |
| 147 | + |
| 148 | +mysql> SHOW VARIABLES LIKE "secure_file_priv"; |
| 149 | ++------------------+-------+ |
| 150 | +| Variable_name | Value | |
| 151 | ++------------------+-------+ |
| 152 | +| secure_file_priv | | |
| 153 | ++------------------+-------+ |
| 154 | +1 row in set (0.01 sec) |
| 155 | + |
121 | 156 | </pre> |
122 | 157 | </div> |
123 | 158 | </div><div xmlns="" id="SOHUCS"></div><script xmlns="" charset="utf-8" type="text/javascript" src="https://cy-cdn.kuaizhan.com/upload/changyan.js"></script><script xmlns="" type="text/javascript"> |
|
0 commit comments