[root@kvm3 ~]# mycli -uroot -p123qwe Connecting to socket /var/lib/mysql/mysql.sock, owned by user mysql MariaDB 10.5.16 mycli 1.26.1 Home: http://mycli.net Bug tracker: https://github.com/dbcli/mycli/issues Thanks to the contributor - Lincoln Loop
MariaDB root@(none):(none)> use dyw; You are now connected to database "dyw" as user "root" Time: 0.001s
MariaDB root@(none):dyw> select * from animals; +----+---------+------+ | id | name | foot | +----+---------+------+ | 1 | dog | 4 | | 2 | cat | 4 | | 3 | chicken | 2 | | 15 | bird | 2 | +----+---------+------+ 4 rows in set Time: 0.057s
MariaDB root@(none):dyw> select * from animals into outfile '/tmp/dump1.txt'; Query OK, 4 rows affected Time: 0.009s
LOAD DATA
讀取檔案資料,匯入資料到資料庫。若要啟用,必須設定 AllowLoadLocalInfile=true。
MariaDB root@(none):dyw> load data local infile '/tmp/dump1.txt' into table anima -> ls; (4166, 'The used command is not allowed because the MariaDB server or client has disabled the local infile capability')
MariaDB root@(none):dyw> quit; Goodbye!
[root@kvm3 ~]# find /tmp/systemd-private-* -name dump1.txt -exec cat {} \; 1 dog 4 2 cat 4 3 chicken 2 15 bird 2