MYSQL记录执行sql_mysql记录所有执行过的sql语句输出到txt
在mysql命令行下执行sql文件*
C:\Windows\system32>cd E:\MySQL\mysql-5.7.16-winx64\bin //将目录切换到mysql的bin文件所在的目录
C:\Windows\system32>mysql -uroot -p520462 -Dtest<E:\test.sql
//mysql -u账号 -p密码 -D数据库名 < sql文件绝对路径
mysql: [Warning] Using a password on the command line interface can be insecure.
article dealer price
0001 a 3.45
0001 b 3.99
0002 a 10.99
0003 b 1045.00
0003 c 1.69
0003 d 1.25
0004 d 19.95
mysql> source E:\test.sql //mysql控制台下执行source E:\test.sql
Database changed
ERROR:
No query specified
±--------±-------±--------+
| article | dealer | price |
±--------±-------±--------+
| 0001 | a | 3.45 |
| 0001 | b | 3.99 |
| 0002 | a | 10.99 |
| 0003 | b | 1045.00 |
| 0003 | c | 1.69 |
| 0003 | d | 1.25 |

本文介绍了如何在MySQL命令行下执行SQL文件,并将执行过的SQL语句记录并输出到TXT文件中,包括使用`mysql -u 用户名 -p 密码 -D 数据库名 < sql文件路径`和在MySQL控制台下使用`source 文件路径`或`.`加文件路径的方式。

588

被折叠的 条评论
为什么被折叠?



