Linux下mysql基本操作

2021-04-20 23:24:25 字數 722 閱讀 8768

1.whereis mysql 檢視mysql安裝在什麼位置

預設路徑/usr/bin/mysql

2.修改密碼

mysqladmin -uroot -pab12 password 456

命令解釋:-u使用者名稱 -p原密碼 password 新密碼

3.登入mysql

mysql -h10.0.0.1 -uroot -p123

-h遠端主機 -u使用者名稱 -p原密碼

登入本機mysql則:mysql -uroot -p123

4.新增使用者

grant select on 資料庫.* to 使用者名稱@登入主機 identified by "密碼";

命令解釋:grant 許可權 on 資料庫 to 使用者名稱@登入主機 identified by "密碼";

5.資料庫操作命令

show databases; //顯示資料庫

use mysql; //開啟庫

show tables; //顯示表

describe 表名; //顯示表結構

create database 庫名; //建立資料庫

use 庫名; 

create table 表名; //字段設定列表

drop database 庫名;

drop table 表名;

delete from 表名;

select * from 表名;

Linux下Mysql的基本操作

service mysql start 鍵入命令mysql u root p,回車後提示你輸密碼。注意使用者名稱前可以有空格也可以沒有空格,但是密碼前必須沒有空格,否則讓你重新輸入密碼.如果剛安裝好mysql,超級使用者root是沒有密碼的,故直接回車即可進入到mysql中了,mysql的提示符是 ...

Linux下的基本操作

ctrl shift c 複製 ctrl shift v 貼上 ping 三次www.linuxprobe.com 正確的命令是 ping c 3 www.linuxprobe.com沒有指定次數時,使用ctrl c 或者ctrl z來終止ping命令的執行 快捷鍵 ctrl shift t 功能 ...

linux下pthread基本操作

include include include include include include include include using namespace std define true 1 define false 0 static void thread1 void arg 列印執行緒建立時...