windows mysql安裝及常用命令

2022-01-10 02:52:50 字數 1864 閱讀 9697

我使用的是mysql-5.7.30-winx64.zip

變數名:mysql_home

變數值:d:\program files\mysql-5.7.30-winx64

path裡新增:%mysql_home%\bin

注:如果需要修改一些配置的話,在解壓目錄下新建配置檔案:my.ini

我的位置:d:\program files\mysql-5.7.30-winx64

[mysql]

# 設定mysql客戶端預設字符集

default-character-set=utf8

[mysqld]

#設定33060埠

port = 33060

# 設定mysql的安裝目錄

basedir=d:\program files\mysql-5.7.30-winx64

# 設定mysql資料庫的資料的存放目錄

datadir=d:\program files\mysql-5.7.30-winx64\data

# 允許最大連線數

max_connections=200

# 服務端使用的字符集預設為8位元編碼的latin1字符集

character-set-server=utf8

# 建立新錶時將使用的預設儲存引擎

default-storage-engine=innodb

net start mysql #啟動服務

net stop mysql #關閉服務

## 連線資料庫,沒有密碼直接回車:

mysql -p 33060 -u root -p

## 新增使用者:

grant all on your_db.* to 'your_username'@'%' identified by 'your_password';

flush privileges; ##重新整理許可權表

select user,host,authentication_string from mysql.user; ##檢視使用者情況

## 備份資料庫

mysqldump -s /tmp/mysql.sock -p -b test_data > test_data.sql

## 檢視表大小:

select table_name, data_length from information_schema.tables where table_schema='webcron';

## 檢視錶行數(基於information_schema)

select t.table_schema,t.table_name,t.table_rows,t.create_time,t.update_time from information_schema.tables t where t.table_name='history' and t.table_schema='zabbix' order by t.create_time desc,t.update_time desc;

## 檢視所有錶行數降序(基於information_schema)

select t.table_schema,t.table_name,t.table_rows,t.create_time,t.update_time from information_schema.tables t where t.table_schema='zabbix' order by t.table_rows desc;

注:如果埠連線被拒絕,注意檢查windows自帶防火牆已關閉

----by 鋼鐵 [email protected] 09.12.2020

windows mysql安裝及遇到的問題

basedir c program files mysql mysql 5.6 datadir c program files mysql mysql 5.6 data 以管理員身份開啟cmd c windows system32 cmd.exemysqld install 安裝服務 mysqld ...

windows mysql安裝及常用命令

變數名 mysql home 變數值 d program files mysql 5.7.30 winx64 path裡新增 mysql home bin 注 如果需要修改一些配置的話,在解壓目錄下新建配置檔案 my.ini 我的位置 d program files mysql 5.7.30 win...

windows MySQL安裝及問題解決

安裝版本為5.6版本,穩定,可靠 第三步 點選mysql community server進入頁面,再點選5.6版本的資料庫 開啟目錄,會看到my default.ini配置檔案,複製這個配置檔案可以重新命名為my.ini或者my.cnf 設定mysql客戶端預設字符集 default charac...