参考: GitHub - svetasmirnova/mysqlcookbook
建库:
mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> CREATE DATABASE cookbook;
Query OK, 1 row affected (0.00 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| carrefour |
| cookbook |
| information_schema |
| menagerie |
| mysql |
| performance_schema |
| sys |
+--------------------+
7 rows in set (0.00 sec)
mysql>
Guide:
[root@MaxwellDBA backup]# ls -ltt
total 16428
-rw-r--r-- 1 root root 16813610 Oct 13 14:18 cookbook.sql
-rw-r--r-- 1 root root 4794 Oct 13 11:03 carrefour_dump.sql
[root@MaxwellDBA backup]# pwd
/var/lib/mysql/backup
[root@MaxwellDBA backup]# mysql -u root -p cookbook < cookbook.sql
Enter password:
[root@MaxwellDBA backup]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 100
Server version: 8.0.26 Source distribution
Copyright (c) 2000, 2021, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| carrefour |
| cookbook |
| information_schema |
| menagerie |
| mysql |
| performance_schema |
| sys |
+--------------------+
7 rows in set (0.00 sec)
mysql> use cookbook
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql>
mysql> show tables;
+-----------------------+
| Tables_in_cookbook |
+-----------------------+
| actors |
| adcount |
| al_winner |
| app_log |
| artist |
| book_authors |
| book_vendor |
| booksales |
| catalog_list |
| cd |
| city |
| color |
| cow_color |
| cow_order |
| date_val |
| datetbl |
| datetime_val |
| die |
| doremi |
| drawing |
| driver_log |
| expt |
| formula1 |
| goods_characteristics |
| goods_shops |
| groceries |
| groceries_order_items |
| hitcount |
| hitlog |
| hostip |
| hostname |
| housewares |
| housewares2 |
| housewares3 |
| housewares4 |
| httpdlog |
| httpdlog2 |
| hw_category |
| image |
| ingredient |
| insect |
| inv_item |
| invoice |
| item |
| limbs |
| mail |
| marathon |
| mark_log |
| metal |
| money |
| movies |
| movies_actors |
| movies_actors_link |
| name |
| news |
| newsstaff |
| numbers |
| obs |
| occasion |
| painting |
| passtbl |
| passwd |
| patients |
| perl_session |
| person |
| php_session |
| phrase |
| player_stats |
| player_stats2 |
| poi |
| poll_vote |
| profile |
| profile_contact |
| rainfall |
| rand_names |
| rank |
| ranks |
| reviews |
| roster |
| ruby_session |
| sales_region |
| sales_tax_rate |
| sales_volume |
| sibling |
| standings1 |
| standings2 |
| states |
| str_val |
| sundays |
| testscore |
| testscore_withmisses |
| testscore_withmisses2 |
| time_val |
| tmp |
| tomcat_role |
| tomcat_session |
| tomcat_user |
| top_names |
| trip_leg |
| trip_log |
| tsdemo |
| weatherdata |
| weekday |
+-----------------------+
103 rows in set (0.00 sec)
mysql>