3、MySQL常用操作

  • 1、MySQL連接
C:\Users\Administrator.EIT-20171107TIY>mysql -u root -p
Enter password: ******
  • 2、斷開(kāi)連接
mysql> exit;
Bye
  • 3、創(chuàng)建數(shù)據(jù)庫(kù),有兩種方式
    • 1、create datebase 數(shù)據(jù)庫(kù)名
C:\Users\Administrator.EIT-20171107TIY>mysql -u root -p
Enter password: ******
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 8.0.15 MySQL Community Server - GPL

Copyright (c) 2000, 2019, 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> create database database_test;
Query OK, 1 row affected (0.01 sec)

mysql>
  • 2、使用 mysqladmin 創(chuàng)建數(shù)據(jù)庫(kù)
C:\Users\Administrator.EIT-20171107TIY>mysqladmin -u root -p create database_tes
t1
Enter password: ******
  • 4、刪除數(shù)據(jù)庫(kù),有兩種方式
    • 1、drop database 數(shù)據(jù)庫(kù)名
mysql> drop database database_test;
Query OK, 0 rows affected (0.01 sec)
  • 2、使用 mysqladmin 刪除數(shù)據(jù)庫(kù)
C:\Users\Administrator.EIT-20171107TIY>mysqladmin -u root -p drop data_test;
Enter password: ******
Dropping the database is potentially a very bad thing to do.
Any data stored in the database will be destroyed.

Do you really want to drop the 'data_test;' database [y/N] y
Database "data_test;" dropped
  • 5、選擇數(shù)據(jù)庫(kù) ,use 數(shù)據(jù)庫(kù)名
mysql> use runoob;
Database changed
mysql>
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀(guān)點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • MYSQL 基礎(chǔ)知識(shí) 1 MySQL數(shù)據(jù)庫(kù)概要 2 簡(jiǎn)單MySQL環(huán)境 3 數(shù)據(jù)的存儲(chǔ)和獲取 4 MySQL基本操...
    Kingtester閱讀 8,060評(píng)論 5 115
  • 什么是數(shù)據(jù)庫(kù)? 數(shù)據(jù)庫(kù)是存儲(chǔ)數(shù)據(jù)的集合的單獨(dú)的應(yīng)用程序。每個(gè)數(shù)據(jù)庫(kù)具有一個(gè)或多個(gè)不同的API,用于創(chuàng)建,訪(fǎng)問(wèn),管理...
    chen_000閱讀 4,143評(píng)論 0 19
  • 1.導(dǎo)出整個(gè)數(shù)據(jù)庫(kù) mysqldump -u 用戶(hù)名 -p –default-character-set=lati...
    往你頭上敲三下閱讀 658評(píng)論 1 10
  • 1.linux下啟動(dòng)mysql的命令:mysqladmin start/ect/init.d/mysql star...
    ljwheyxy閱讀 461評(píng)論 0 2
  • ORA-00001: 違反唯一約束條件 (.) 錯(cuò)誤說(shuō)明:當(dāng)在唯一索引所對(duì)應(yīng)的列上鍵入重復(fù)值時(shí),會(huì)觸發(fā)此異常。 O...
    我想起個(gè)好名字閱讀 5,963評(píng)論 0 9

友情鏈接更多精彩內(nèi)容