Ubuntu install mysql database

來源:互聯網
上載者:User

標籤:primary   cal   內容   etc   控制台   oca   address   資料庫   nbsp   

簡要說下ubuntu Linux下安裝MySql資料庫

一。 安裝

# apt-get install mysql-server
# apt-get install mysql-client

二。啟動

# sudo start mysql

查看一下是否建立監聽

# netstat -tap | grep mysql
tcp 0 0 localhost:mysql *:* LISTEN 15910/mysqld

三。取消本機唯一訪問限制

/etc/mysql/my.cnf 檔案裡,注釋調這句 bind-address = 127.0.0.1

四 mysql相關命令

//進入mysql控制台

mysql -uroot -p

輸入密碼即可登陸

1. 建立資料庫

mysql>create [database name];

2. 顯示數庫

mysql>show databases;

3. 使用資料庫

mysql>use [database name];

4. 建立表

請注意:是鍵盤左上方的··而不是單引號‘‘

mysql>CREATE TABLE `ud1` (
[->]`uid` INT(10) NOT NULL DEFAULT ‘0‘,
[->]`intro` TEXT NULL,
[->]PRIMARY KEY (`uid`)
[->]);

請注意:這裡是SQL語句,關鍵字都得大寫

5.顯示表

->mysql>show tables

6.查詢表中內容

mysql> select * from [table name];

 

Ubuntu install mysql database

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.