[root@kvm3 ~]# mycli -S /var/lib/mysql/mysql.sock -uroot -p123qwe mariadb 10.3.11-MariaDB mycli 1.20.1 Chat: https://gitter.im/dbcli/mycli Mail: https://groups.google.com/forum/#!forum/mycli-users Home: http://mycli.net Thanks to the contributor - Steve Robbins
mariadb root@localhost:(none)> use dyw; You are now connected to database "dyw" as user "root" Time: 0.001s
mariadb root@localhost:dyw> create table person(fname char(20) not null,lname ch ar(20) not null, sex char(10), primary key(lname,fna me)); Query OK, 0 rows affected Time: 0.041s
mariadb root@localhost:dyw> insert ignore into person(lname,fname) values('Wang' ,'De-Yu'); Query OK, 1 row affected Time: 0.004s mariadb root@localhost:dyw> select * from person; +-------+-------+--------+ | fname | lname | sex | +-------+-------+--------+ | De-Yu | Wang | <null> | +-------+-------+--------+ 1 row in set Time: 0.020s
mariadb root@localhost:dyw> insert into person(lname,fname) values('Wang','De-Yu '); (1062, "Duplicate entry 'Wang-De-Yu' for key 'PRIMARY'")
mariadb root@localhost:dyw> insert ignore into person(lname,fname) values('Wang' ,'De-Yu'); Query OK, 0 rows affected Time: 0.006s mariadb root@localhost:dyw> select * from person; +-------+-------+--------+ | fname | lname | sex | +-------+-------+--------+ | De-Yu | Wang | <null> | +-------+-------+--------+ 1 row in set Time: 0.020s
mariadb root@localhost:dyw> replace into person(lname,fname) values('Lin','Linda '); Query OK, 1 row affected Time: 0.004s mariadb root@localhost:dyw> select * from person; +-------+-------+--------+ | fname | lname | sex | +-------+-------+--------+ | Linda | Lin | <null> | | De-Yu | Wang | <null> | +-------+-------+--------+ 2 rows in set Time: 0.023s
mariadb root@localhost:dyw> insert ignore into person(lname,fname,sex) values('L in','Linda','F'); Query OK, 0 rows affected Time: 0.002s mariadb root@localhost:dyw> select * from person; +-------+-------+--------+ | fname | lname | sex | +-------+-------+--------+ | Linda | Lin | <null> | | De-Yu | Wang | <null> | +-------+-------+--------+ 2 rows in set Time: 0.024s
mariadb root@localhost:dyw> replace into person(lname,fname,sex) values('Lin','L inda','F'); Query OK, 1 row affected Time: 0.004s mariadb root@localhost:dyw> select * from person; +-------+-------+--------+ | fname | lname | sex | +-------+-------+--------+ | Linda | Lin | F | | De-Yu | Wang | <null> | +-------+-------+--------+ 2 rows in set Time: 0.025s