1.登錄MySQL

10年積累的成都網(wǎng)站建設(shè)、網(wǎng)站設(shè)計經(jīng)驗,可以快速應(yīng)對客戶對網(wǎng)站的新想法和需求。提供各種問題對應(yīng)的解決方案。讓選擇我們的客戶得到更好、更有力的網(wǎng)絡(luò)服務(wù)。我雖然不認(rèn)識你,你也不認(rèn)識我。但先網(wǎng)站制作后付款的網(wǎng)站建設(shè)流程,更有雁江免費網(wǎng)站建設(shè)讓你可以放心的選擇與我們合作。
登錄MySQL的命令是mysql, mysql 的使用語法如下:
mysql [-u username] [-h host] [-p[password]] [dbname]
username 與 password 分別是 MySQL 的用戶名與密碼,mysql的初始管理帳號是root,沒有密碼,注意:這個root用戶不是Linux的系統(tǒng)用戶。MySQL默認(rèn)用戶是root,由于 初始沒有密碼,第一次進(jìn)時只需鍵入mysql即可。
[root@test1 local]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.0.16-standard
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql
出現(xiàn)了“mysql”提示符,]
這說明你安裝是成功的。
2.MySQL默認(rèn)沒有密碼,安裝完畢增加密碼的重要性是不言而喻的。
1、命令
usr/bin/mysqladmin -u root password 'new-password'
格式:mysqladmin -u用戶名 -p舊密碼 password 新密碼
2、例子
例1:給root加個密碼123456。
鍵入以下命令 :
[root@test1 local]# /usr/bin/mysqladmin -u root password 123456
注:因為開始時root沒有密碼,所以-p舊密碼一項就可以省略了。
3.增加了密碼后的登錄格式如下:
mysql -u root -p
Enter password: (你自己設(shè)的密碼)
其中-u后跟的是用戶名,-p要求輸入密碼,回車后在輸入密碼處輸入密碼。
4.到這兒就基本OK,可以順利進(jìn)入mysql
(1) 進(jìn)入mysql控制臺,直接輸入mysql命令即可,如下。
# mysql
(2) 啟動mysql: 進(jìn)入mysql控制的前提是保證mysql服務(wù)啟動,如下命令可以啟動mysql
# /etc/init.d/mysqld start
其它的mysql數(shù)據(jù)庫相關(guān)的操作如下
(1) 創(chuàng)建數(shù)據(jù)庫TestDB
mysql create database TestDB;
(2) 制定TestDB數(shù)據(jù)庫為當(dāng)前默認(rèn)數(shù)據(jù)庫
mysql use TestDB;
(3) 在TestDB數(shù)據(jù)庫中創(chuàng)建表customers
mysql create table customers(userid int not null, username varchar(20) not null);
(4) 顯示數(shù)據(jù)庫列表
mysql show databases;
(5)顯示數(shù)據(jù)庫中的表
mysql show tables;
(6)刪除表customers
mysql drop table customers;
(7)顯示customers表的結(jié)構(gòu)
mysql desc customers;
(8) 向customers表中插入一條記錄
mysql insert into customers(userid, username) values(1, 'hujiahui');
(9) 讓操作及時生效;
mysql commit;
(10) 查詢customers中的記錄
mysql select * from customers;
(11) 更新表中的數(shù)據(jù)
mysql update customers set username='DennisHu' where userid=1;
(12) 刪除表中的記錄
mysql delete from customers;
(13)授予hjh用戶訪問數(shù)據(jù)庫的權(quán)限
# grant select, insert, update, delete on *.* to hjh@localhost indentified by "123456";
備注:hjh是Linux用戶名,123456是訪問mysql的密碼
(14)采用用戶名和密碼登錄mysql
# mysql -uhjh -p123456
把phpstudy中mysql的路徑放入環(huán)境變量:
(win7)右鍵我的電腦,屬性,高級系統(tǒng)設(shè)置
環(huán)境變量,系統(tǒng)變量,修改“Path”的值,加入如上路徑。
新聞標(biāo)題:怎么進(jìn)入mysql監(jiān)視器 如何監(jiān)控mysql數(shù)據(jù)庫
當(dāng)前網(wǎng)址:http://www.chinadenli.net/article10/dddgggo.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供建站公司、全網(wǎng)營銷推廣、企業(yè)建站、網(wǎng)站建設(shè)、網(wǎng)站營銷、外貿(mào)網(wǎng)站建設(shè)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)