在64位Windows7操作系統(tǒng)上安裝和配置MySql數(shù)據(jù)庫系統(tǒng)。
一、mysql5.7.11 winx64安裝配置方法
步驟:
1、官網(wǎng)下載MySQL數(shù)據(jù)庫和驅(qū)動(dòng)程序(Windows):mysql-5.7.11-winx64.zip
2、創(chuàng)建數(shù)據(jù)庫配置文件:my.ini
Example:
1.解壓壓縮包至:D:\Program Files
2.創(chuàng)建 D:\Program Files\mysql-5.7.11-winx64\my.ini 配置文件
3、初始化和啟動(dòng)Mysql服務(wù):
1.以管理員權(quán)限運(yùn)行cmd
2.進(jìn)入mysql的bin下
3.初始化,生成data文件夾
>mysqld --initialize-insecure (不設(shè)置root密碼,建議使用)
>mysqld --initialize (生成一個(gè)隨機(jī)的root密碼)
3.安裝MySql服務(wù)
>mysqld -install
4.啟動(dòng)mysql
>net start mysql
4、登陸mysql
>mysql -u root -p
第一次登錄時(shí)無需密碼直接回車登錄
登錄mysql之后,設(shè)置root密碼
>set password for root@localhost = password('YourPassword');
或者使用mysqlamdin修改root密碼
>mysqladmin -u root -p password NewPassword
二、簡單的數(shù)據(jù)庫操作和測試
1、以管理員權(quán)限運(yùn)行cmd,進(jìn)入程序所在目錄,啟動(dòng)Mysql服務(wù)
2、數(shù)據(jù)庫操作
1
2
3
4
|
show databases; //所有數(shù)據(jù)庫列表 create database dbName; //創(chuàng)建數(shù)據(jù)庫 use dbName; //選擇數(shù)據(jù)庫 show tables; //顯示數(shù)據(jù)表列表 |
3、查看數(shù)據(jù)表中的條目
1
2
3
4
|
desc tableName; describe tableName; show columns from tableName; show create table tableName; |
4、清空數(shù)據(jù)表中所有條目:
truncate table 表名; //清空全部數(shù)據(jù),不寫日志,不可恢復(fù),速度極快
delete from 表名; //清空全部數(shù)據(jù),寫日志,數(shù)據(jù)可恢復(fù),速度慢
以上就是mysql 5.7.11winx64安裝配置方法,希望對(duì)大家的學(xué)習(xí)有所幫助。