- 工信部備案號 滇ICP備05000110號-1
- 滇公安備案 滇53010302000111
- 增值電信業(yè)務(wù)經(jīng)營許可證 B1.B2-20181647、滇B1.B2-20190004
- 云南互聯(lián)網(wǎng)協(xié)會理事單位
- 安全聯(lián)盟認(rèn)證網(wǎng)站身份V標(biāo)記
- 域名注冊服務(wù)機(jī)構(gòu)許可:滇D3-20230001
- 代理域名注冊服務(wù)機(jī)構(gòu):新網(wǎng)數(shù)碼
1.開啟和關(guān)閉
net stop mysql #停止mysql
net start mysql #開啟mysql
2.進(jìn)入mysql服務(wù)
mysql -uuser -ppassword
有時候會提示”mysql命令不存在”,我們需要在path路徑中添加mysql路徑如:D:mysqlin,
3.相關(guān)的基本查詢
show databases; #查看所有數(shù)據(jù)庫
use db_name; #選擇某個數(shù)據(jù)庫
show talbes; #查看選擇后的某數(shù)據(jù)庫所有表
4.創(chuàng)建數(shù)據(jù)庫和用戶,并且把數(shù)據(jù)庫和用戶進(jìn)行關(guān)聯(lián)
create database db_name; #創(chuàng)建數(shù)據(jù)庫db_name
create user db_user@localhost identified by ‘user_password’;
grant all privileges on db_name.* to db_user@localhost;
5.創(chuàng)建表,如:
create table myclass(
> id int(4) not null primary key auto_increment,
> name char(20) not null,
> sex int(4) not null default ‘0’);
6.簡單查看表,如select * from myclass;
7.刪除
drop table myclass; #刪除表
delete from myclass; #清空表
drop db_name #刪除庫
8.導(dǎo)入導(dǎo)出數(shù)據(jù)庫
mysqldump -udb_user -pdb_password db_name > d:db_name.sql #備份數(shù)據(jù)庫
mysql -udb_user -pdb_password db_name < d:db_name.sql #還原數(shù)據(jù)庫
mysql > source D:/db_name.sql #也可以用source命令還原數(shù)據(jù)庫,前提是先用use db_name命令選擇數(shù)據(jù)庫
9.修復(fù)表
repair table table_name; #修復(fù)表
optimize talbe talbe_name; #優(yōu)化表
售前咨詢
售后咨詢
備案咨詢
二維碼
TOP