MySQL是一種開源的關系型數據庫管理系統,它被廣泛應用于各種應用程序的數據存儲和管理。當我們打開MySQL時,我們將看到以下內容:
Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 3 Server version: 5.7.22 MySQL Community Server (GPL) Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. 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>
這是MySQL監視器的歡迎界面,我們可以在MySQL監視器中執行各種SQL命令。下面是一些基本命令,您可以在MySQL監視器中嘗試:
mysql> SHOW DATABASES; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | test | +--------------------+ 4 rows in set (0.00 sec) mysql> CREATE DATABASE mydatabase; Query OK, 1 row affected (0.00 sec) mysql> USE mydatabase; Database changed mysql> CREATE TABLE mytable ( -> id INT, -> name VARCHAR(255), -> age INT -> ); Query OK, 0 rows affected (0.00 sec) mysql> INSERT INTO mytable (id, name, age) VALUES (1, 'Alice', 18); Query OK, 1 row affected (0.00 sec) mysql> SELECT * FROM mytable; +------+------+-----+ | id | name | age | +------+------+-----+ | 1 | Alice| 18 | +------+------+-----+ 1 row in set (0.00 sec)
這些基本命令可以幫助您開始使用MySQL,嘗試在您的本地計算機上安裝MySQL,并使用這些命令創建您自己的數據庫和表。祝你好運!