共計 869 個字符,預計需要花費 3 分鐘才能閱讀完成。
自動寫代碼機器人,免費開通
本篇內容主要講解“最常用 mysql 的使用方法”,感興趣的朋友不妨來看看。本文介紹的方法操作簡單快捷,實用性強。下面就讓丸趣 TV 小編來帶大家學習“最常用 mysql 的使用方法”吧!
1、在 shell 下使用 mysql,按照下面的方法。
$mysql -u
-p
password:
mysql show databases; // 顯示有哪些數據庫
mysql create DATABASE lll; // 創建一個名為 lll 的數據庫
mysql use lll; // 使用名為 lll 的數據庫
mysql show tables; // 顯示當前數據庫中有哪些表
mysql CREATE TABLE user (username TEXT not null , userpassword TEXT not null) // 創建一個表
mysql ALTER TABLE user ADD email TEXT not null; // 當前表增加一個字段
mysql ALTER TABLE test DROP come; // 當前表丟棄一個字段
mysql ALTER TABLE test CHANGE pass pass LONGTEXT not null; // 更改當前表中的一個字段
mysql DROP TABLE user;// 丟棄當前數據庫中的一個表。
2、php3 代碼實現數據庫的創建;
$dbc=mysql_connect(localhost , youruser , yourpassword
mysql_create_db(zzz); // 創建一個名為 zzz 的數據庫
echo 成功
?
3、使用 php3 創建一個表:
$dbc=mysql_connect(localhost , root ,
mysql_select_db(zzz ,$dbc);
mysql_query(CREATE TABLE user (username TEXT not null , userpassword TEXT not null)
到此,相信大家對“最常用 mysql 的使用方法”有了更深的了解,不妨來實際操作一番吧!這里是丸趣 TV 網站,更多相關內容可以進入相關頻道進行查詢,關注我們,繼續學習!
向 AI 問一下細節