mysql常使用的命令

2021-08-27 22:30:54 字數 2136 閱讀 8903

登入資料庫

>

mysql -uroot -p;
會提示你輸入密碼

[i]登入修改資料庫的密碼[/i]

set password for 'root'@'localhost' = password('newpass');

[i]用mysqladmin[/i]

mysqladmin -u root password "newpass"

如果root已經設定過密碼,採用如下方法

mysqladmin -u root password oldpass "newpass"

[i]用update直接編輯user表[/i]

mysql -u root

mysql> use mysql;

mysql> update user set password = password('newpass') where user = 'root';

mysql> flush privileges;

[i]在丟失root密碼的時候[/i]

mysqld_safe --skip-grant-tables&

mysql -u root mysql

mysql> update user set password=password("new password") where user='root';

mysql> flush privileges;

[b]資料庫連線許可權指定[/b]

[i]授權使用者root使用密碼root從任意主機連線到mysql伺服器:[/i]

grant all privileges on *.* to 'root'@'%' identified by 'root' with grant option;

flush privileges;
生效

[i]授權使用者root使用密碼root從指定ip為10.96.170.53的主機連線到mysql伺服器:[/i]

grant all privileges on *.* to 'root'@'218.12.50.60' identified by 'enjoy3c_p' with grant option;

grant all privileges on database.* to 'root'@'218.12.50.60' identified by 'enjoy3c_p' with grant option;
指定資料庫

flush privileges;
生效

[b]資料庫連線檢視和修改[/b]

[i]檢視最大連線數:[/i]

show variables like '%max_connections%';

[i]修改最大連線數[/i]

1.mysql配置檔案 my.ini 或 my.cnf,修改

max_connections=100

2.

set global max_connections=200
。這種方式在mysql重啟時候不會生效建議第一種

[i]檢視所有的訪問資訊[/i]

show processlist;
只列出前100條,如果想全列出請使用
show full processlist;

找到了連線去看看具體的狀態

命令:

show status;

命令:

show status like '%下面變數%';

[i]檢視連線當前資料庫的ip的數量[/i]

select substring_index(host,':',1) as ip , count(*) from information_scheme.processlist group by ip;

mysql生效命令 mysql常使用的命令

mysql uroot p 會提示你輸入密碼 登入修改資料庫的密碼 set password for root localhost password newpass 用mysqladmin mysqladmin u root password newpass 如果root已經設定過密碼,採用如下方法...

vim常使用的命令

vim複製命令 y 複製,適用於選擇文字後再按y複製 yw 複製乙個單詞 包括空格 ye 複製乙個單詞 不包括空格 yy 複製一整行,類似dd刪除一整行 包括行尾換行符 y 複製一整行 包括行尾換行符 不同於d刪除到行尾 不包括換行符 2yy 或 y2y 複製兩行 ggyg複製全部 注 y為操作符,...

常使用的adb命令

截圖,放在d盤目錄下 adb shell system bin screencap p sdcard screenshot.png adb pull sdcard screenshot.png d screenshot.png 截屏保存在sd卡中 sd卡中輸入電腦到d screenshot.png ...