新聞中心
以下是MySql的一些常用命令
// 啟動服務(wù)
mysqld --console
// 停止服務(wù)mysqladmin -u root shutdown
// 登錄后使用數(shù)據(jù)庫 mysqlmysql -u root -p mysqlmysql -u root -p -h 11.11.11.11 database
// 創(chuàng)建數(shù)據(jù)庫create database db_name [default character set=gbk]
// 設(shè)置數(shù)據(jù)庫默認字符集alter databse db_name default character set gbk
// 更換數(shù)據(jù)庫 use database test after log onuse test
// 創(chuàng)建一個帶圖像字段的表 create a table mypic to store picturecreate table mypic (picid int, picname varchar(20), content blob);
// 顯示表的結(jié)構(gòu) describe table mypicdesc mypic
// 顯示當(dāng)前表的建表語句show create table table_name
// 更改表類型alter table table_name engine innodb|myisam|memory
// 插入一條記錄 insert a recordinsert into mypic values (1, '第二章', 0x2134545);
// 顯示當(dāng)前用戶 show current userselect user();
// 顯示當(dāng)前用戶密碼 show current passwordselect password('root');
// 顯示當(dāng)前日期 show current dateselect now();
// 更改用戶密碼 change user passwordupdate user set password=password('xxx') where user='root';
// 分配用戶權(quán)限 grantgrant all privileges on *.* toroot@localhostgrant select,insert,delete,update,alter,create,drop on lybbs.* tolybbs@"%" identified by "lybbs";grant select,insert,delete,update,alter,create,drop on lybbs.* tolybbs@localhostidentified by "lybbs";
// 在不重啟的情況下刷新用戶權(quán)限 flush privilegesflush privileges
// 向表中增加一個主鍵 add primary keyalter table mypic add primary key (picid)
// 修改表結(jié)構(gòu)增加一個新的字段 add a new column userid after picidalter table mypic add column userid int after picid
// 更改列類型,當(dāng)存儲圖像過大時,使用默認blob超不過100kalter table userpic change image image longblob;alter table userpic modify image longblob;
// 設(shè)置默認字符集為gb2312mysqld --default-character-set=gb2312
// 顯示詳細信息,包括字符集編碼show full columns from userpic;
// 改變表的編碼ALTER TABLE userpic CHARACTER SET gb2312;
// mysql jdbc連接url 使用中文jdbc:mysql://localhost/test?useUnicode=true&characterEncoding=gb2312
// 執(zhí)行外部腳本source
MySQL是最受歡迎的開源SQL數(shù)據(jù)庫管理系統(tǒng),由MySQL AB開發(fā)、發(fā)布和支持。MySQL AB是一家基于MySQL開發(fā)人員的商業(yè)公司,是一家使用了一種成功的商業(yè)模式來結(jié)合開源價值和方法論的第二代開源公司。MySQL是MySQL AB的注冊商標(biāo)。
MySQL是一個快速的、多線程、多用戶和健壯的SQL數(shù)據(jù)庫服務(wù)器。
網(wǎng)頁名稱:云服務(wù)器安裝MySq后l的常用命令
網(wǎng)頁地址:http://fisionsoft.com.cn/article/cjdoec.html