国产宅男网站在线|亚洲A级性爱免费视频|亚洲中精品级在线|午夜福利AA毛

  • <dd id="gf5jf"><th id="gf5jf"></th></dd>

    <cite id="gf5jf"><label id="gf5jf"></label></cite>
  • <div id="gf5jf"><listing id="gf5jf"></listing></div>
    學習啦>學習電腦>操作系統(tǒng)>Linux教程>

    linux mysql創(chuàng)建數(shù)據(jù)庫命令

    時間: 佳洲1085 分享

      我們除了可以在mysql數(shù)據(jù)庫或phpmyadmin中登陸數(shù)據(jù)庫我們還可以使用linux中命令進行創(chuàng)建,下面由學習啦小編為大家整理了linux mysql創(chuàng)建數(shù)據(jù)庫命令,希望大家喜歡!

      linux mysql創(chuàng)建數(shù)據(jù)庫命令步驟

      (1)首選用putty連接linux服務器,進行命令行

      輸入MySQL -u+數(shù)據(jù)庫用戶 -p+數(shù)據(jù)庫密碼

      架設數(shù)據(jù)庫用戶是root 密碼是123,應該是像下面這樣才是正確的:

      mysql -uroot -p123

      -u和-p連接數(shù)據(jù)庫用戶和密碼中間是不能有空格的

      (2)下面來創(chuàng)建數(shù)據(jù)庫mydatabase

      create database mydatabase;

      這樣一個名叫mydatabase的數(shù)據(jù)庫就創(chuàng)建好了

      show databases; 顯示所有數(shù)據(jù)庫列表

      drop database mydatabase; 刪除數(shù)據(jù)庫mydatabase

      (3)那么如何退出mysql命令行呢

      在終端輸入exit; 知道完全退出mysql命令行為止

      附后一些常用的命令

      (4) 制定TestDB數(shù)據(jù)庫為當前默認數(shù)據(jù)庫

      mysql> use TestDB;

      (5) 在TestDB數(shù)據(jù)庫中創(chuàng)建表customers

      mysql> create table customers(userid int not null, username varchar(20) not null);

      (6) 顯示數(shù)據(jù)庫列表

      mysql> show databases;

      (7)顯示數(shù)據(jù)庫中的表

      mysql> show tables;

      (8)刪除表customers

      mysql> drop table customers;

      (9)顯示customers表的結構

      mysql> desc customers;

      (10) 向customers表中插入一條記錄

      mysql> insert into customers(userid, username) values(1, 'hujiahui');

      (11) 讓操作及時生效;

      mysql> commit;

      (12) 查詢customers中的記錄

      mysql> select * from customers;

      (12) 更新表中的數(shù)據(jù)

      mysql> update customers set username='DennisHu' where userid=1;

      (13) 刪除表中的記錄

      mysql> delete from customers;

      (14)授予hjh用戶訪問數(shù)據(jù)庫的權限

      # grant select, insert, update, delete on *.* to hjh@localhost indentified by "123456";

      備注:hjh是Linux用戶名,123456是訪問mysql的密碼

      (15)采用用戶名和密碼登錄mysql

      # mysql -uhjh -p123456

    linux mysql創(chuàng)建數(shù)據(jù)庫命令

    我們除了可以在mysql數(shù)據(jù)庫或phpmyadmin中登陸數(shù)據(jù)庫我們還可以使用linux中命令進行創(chuàng)建,下面由學習啦小編為大家整理了linux mysql創(chuàng)建數(shù)據(jù)庫命令,希望大家喜歡! linux mysql創(chuàng)建數(shù)據(jù)庫命令步驟 (1)首選用putty連接linux服務器,進行
    推薦度:
    點擊下載文檔文檔為doc格式
    3571625