Linux中MySQL怎么用

這篇文章將為大家詳細(xì)講解有關(guān)Linux中MySQL怎么用,小編覺得挺實(shí)用的,因此分享給大家做個(gè)參考,希望大家閱讀完這篇文章后可以有所收獲。

創(chuàng)新互聯(lián)成立于2013年,我們提供高端成都網(wǎng)站建設(shè)、成都網(wǎng)站制作成都網(wǎng)站設(shè)計(jì)、網(wǎng)站定制、網(wǎng)絡(luò)營銷推廣、微信平臺(tái)小程序開發(fā)、微信公眾號(hào)開發(fā)、網(wǎng)站推廣服務(wù),提供專業(yè)營銷思路、內(nèi)容策劃、視覺設(shè)計(jì)、程序開發(fā)來完成項(xiàng)目落地,為iso認(rèn)證企業(yè)提供源源不斷的流量和訂單咨詢。

1.show databases;Linux中MySQL怎么用


2.use mysql轉(zhuǎn)換databaseLinux中MySQL怎么用


3.show tables 顯示數(shù)據(jù)庫里的表Linux中MySQL怎么用


4.select user,host,password from user查詢我的數(shù)據(jù)庫mysql的user,host,passwordLinux中MySQL怎么用


5.給賬號(hào)設(shè)置密碼
mysql> update user set password=password('123456') where user='root';Linux中MySQL怎么用


6.清除空用戶
delete From user where user='' ;Linux中MySQL怎么用


7.查看剩余用戶
Linux中MySQL怎么用命令與上文相同的查詢用戶命令 

8.刷新權(quán)限(重點(diǎn))
命令flush privileges;Linux中MySQL怎么用每次操作結(jié)束后都要刷新權(quán)限??!


9.通過用戶進(jìn)入數(shù)據(jù)庫
mysql -u root -p123456; (-p后全是密碼)Linux中MySQL怎么用



10.編輯.bash_profile文件(此步驟是為了可以讓我們使用which mysql直接找到mysql文件在哪)
vi 。bash_profile修改為# .bash_profile
 

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi


# User specific environment and startup programs


PATH=$PATH:$HOME/bin
                                     1,1           Top
# .bash_profile


# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi


# User specific environment and startup programs

export MYSQL_BASE=/usr/local/mysql
export PATH=${MYSQL_BASE}/bin:$PATH

PS1=`uname -n`":"'$USER'":"'$PWD'":>"; export PS1得到結(jié)果Linux中MySQL怎么用


11.創(chuàng)建一個(gè)新的數(shù)據(jù)庫并且設(shè)定可以進(jìn)入他的機(jī)器
11.1 create database ruozedb;創(chuàng)建數(shù)據(jù)庫ruozedb
11.2grant all privileges on ruozedb.* to ruoze@'192.168.137.252' identified by '123456'設(shè)定可以進(jìn)入數(shù)據(jù)庫ruozedb的用戶只有IP為192.168.137.252的用戶名叫做ruoze且密碼為123456(如果把IP地址改為%則表示任意ID都可以用ruoze用戶進(jìn)入)
11.3flush privileges;權(quán)限刷新
實(shí)踐如圖:Linux中MySQL怎么用


12.連接Dbeaver

Linux中MySQL怎么用

關(guān)于“Linux中MySQL怎么用”這篇文章就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,使各位可以學(xué)到更多知識(shí),如果覺得文章不錯(cuò),請(qǐng)把它分享出去讓更多的人看到。

網(wǎng)頁名稱:Linux中MySQL怎么用
本文來源:http://bm7419.com/article2/jdcgic.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站收錄做網(wǎng)站、企業(yè)建站、網(wǎng)站排名、網(wǎng)站設(shè)計(jì)公司、服務(wù)器托管

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

網(wǎng)站優(yōu)化排名