win10系統 64位 安裝MySQL-5.7.20

使用安裝版本 mysql-5.7.20
1. mysql-5.7.20版本解壓縮后里面沒有my.ini文件,需要自己創建該文件,並創建data空文件夾
my.ini
---------------------------------------------------------------------------------------------------------------------------
[mysql]
# 設置mysql客戶端默認字符集
default-character-set=utf8
[mysqld]
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
# These are commonly set, remove the # and set as required.
basedir=C:\SoftWare\mysql-5.7.20
datadir=C:\SoftWare\mysql-5.7.20\data
tmpdir=C:\SoftWare\mysql-5.7.20\data
port=3306
server_id=1234
# 允許最大連接數
max_connections=200
# 服務端使用的字符集默認爲8比特編碼的latin1字符集
character-set-server=utf8
# 創建新表時將使用的默認存儲引擎
default-storage-engine=INNODB
sql-mode=NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
explicit_defaults_for_timestamp=true
------------------------------------------------------------------------------------------------------------------
注意:如果初始配置文件中有“skip-grant-tables”配置,則在後續配置用戶時無法操作成功
2. 配置和環境變量
MYSQL_HOME
Path
3.以管理員身份打開cmd命令行窗口開始配置
具體過程參考

附錄:MySql命令
安裝命令  mysqld install
初始化命令 mysqld --initialize
開啓mysql服務 net start mysql
停止mysql服務 net stop mysql
root用戶登錄mysql服務 mysql -u root -p
提示輸入密碼 第一次輸入的密碼爲系統隨機生成的,進入後可以自己修改密碼
修改root用戶密碼 set password for 'root'@'localhost' = password('newpassword');
創建新用戶 create user 'username'@'host' identified by 'password';
username:用戶名
host: 允許用戶登錄的主機地址,使用localhost或本機IP表示只允許在本機登錄,使用%表示允許   在任意主機登錄MYSQL
password:爲用戶設置密碼,不設置時密碼爲空
授權 grant privileges on databasename.tablename to 'username'@'host'
privileges:授權類別,如select、insert等。all表示所有權限。
databasename:授權操作的數據庫名稱。
tablename:授權操作的表名稱。
databasename和tablename可以用‘*’表示所有的數據庫和表。
退出登錄 exit





發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章