linux 操作sqlite3示例

一.修改表中数据示例

  1.找到要修改的db文件,这里是db.sqlite3文件, 找到要修改的表,修改密码名和密码

[root@iZwz927xptl8kw8zqrmwvcZ dbs]# pwd
/usr/local/gerapy/dbs
[root@iZwz927xptl8kw8zqrmwvcZ dbs]# ls
db.sqlite3
[root@iZwz927xptl8kw8zqrmwvcZ dbs]# sqlite3 db.sqlite3
SQLite version 3.26.0 2018-12-01 12:34:55
Enter ".help" for usage hints.
sqlite> .database
main: /usr/local/gerapy/dbs/db.sqlite3
sqlite> .table
auth_group                             core_monitor
auth_group_permissions                 core_project
auth_permission                        core_task
auth_user                              django_admin_log
auth_user_groups                       django_apscheduler_djangojob
auth_user_user_permissions             django_apscheduler_djangojobexecution
authtoken_token                        django_content_type
core_client                            django_migrations
core_deploy                            django_session
sqlite> .header on
sqlite> .mode column
sqlite> SELECT * FROM auth_user;
id          password                                                                        last_login  is_superuser                                                         username    first_name  email             is_staff    is_active   date_joined                 last_name
----------  ------------------------------------------------------------------------------  ----------  ------------                                                         ----------  ----------  ----------------  ----------  ----------  --------------------------  ----------
1           pbkdf2_sha256$150000$YmAGQtkPl8a5$2ParvuD/MEz9/JPMby1oufaF6njLcg8piCxoeG3PLTM=              1                                                                    admin                   admin@gerapy.com  1           1           2022-07-22 03:24:34.150657
sqlite> UPDATE auth_user set username='xxx', email='xxx.com'  where id=1;
sqlite> SELECT * FROM auth_user;
id          password                                                                        last_login  is_superuser                                                         username    first_name  email                 is_staff    is_active   date_joined                 last_name
----------  ------------------------------------------------------------------------------  ----------  ------------                                                         ----------  ----------  --------------------  ----------  ----------  --------------------------  ----------
1           pbkdf2_sha256$150000$YmAGQtkPl8a5$2ParvuD/MEz9/JPMby1oufaF6njLcg8piCxoeG3PLTM=              1                                                                    xxx                     xxx.com  1           1           2022-07-22 03:24:34.150657

 退出编辑:.exit

posted on 2022-07-22 11:46  花阴偷移  阅读(429)  评论(0编辑  收藏  举报

导航