1. 程式人生 > >MySQL服務解壓版安裝

MySQL服務解壓版安裝

日誌 停止 安裝 窗口 options 數據庫 cto mysql- 解壓版

1.環境變量配置

  右鍵計算機–屬性–高級系統設置–環境變量,在系統變量中找到Path編輯,在結尾處追加你的mysql的bin文件夾地址D:\Program Files\mysql-8.0.12-winx64\bin
2.創建my.ini文件
[client]

# pipe=

socket=MYSQL

port=3306

[mysql]
no-beep

# default-character-set=


# SERVER SECTION
# ----------------------------------------------------------------------
#
# The following options will be read by the MySQL Server. Make sure that


# you have installed the server correctly (see above) so it reads this
# file.
#
# server_type=3
[mysqld]

# The next three options are mutually exclusive to SERVER_PORT below.
# skip-networking
# enable-named-pipe
# shared-memory

# shared-memory-base-name=MYSQL

# The Pipe the MySQL Server will use
# socket=MYSQL

# The TCP/IP Port the MySQL Server will listen on
port=3306

# Path to installation directory. All paths are usually resolved relative to this.
basedir=D:\Program Files\mysql-8.0.12-winx64

# Path to the database root
datadir=D:\Program Files\mysql-8.0.12-winx64\data

# The default character set that will be used when a new schema or table is


# created and no character set is defined
# character-set-server=

# The default storage engine that will be used when create new tables when
default-storage-engine=INNODB

# Set the SQL mode to strict
sql-mode=
3.配置MySQL服務
a) 用管理員身份打開cmd,進入mysql的bin文件夾。(註意要用管理員打開,否則權限不足)
b)執行:mysqld -install,顯示:Service successfully installed. 則註冊服務成功。如果要刪除服務:mysqld -remove c)MySQL數據庫在升級到5.7版本後,和之前的版本有些不一樣,沒有data文件夾,MySQL數據庫文件是保存在data文件夾中的,標準的修改方法是,打開cmd命令窗口,並且進入到MySQL安裝目錄中的bin目錄,然後輸入如下命令初始化數據:mysqld –initialize-insecure 。執行完上面命令後,MySQL會自建一個data文件夾,並且建好默認數據庫,登錄的用戶名為root,密碼為空。
d)安裝成功後就要啟動服務了,繼續在cmd中輸入net start mysql,停止服務net stop mysql。
如果失敗查看錯誤日誌,D:\Program Files\mysql-8.0.12-winx64\data下*.err日誌
4 登陸mysql服務,修改密碼
a)繼續在cmd中輸入:mysql -u root 回車,密碼為空,繼續回車,連接上mysql。
b)屏蔽權限:mysqld --skip-grant-tables.flush privileges;
c)8.0版本以上: alter user ‘root‘@‘localhost‘IDENTIFIED BY ‘123‘;註:mysql8.0以上密碼策略限制必須要大小寫加數字特殊符號,我沒碰到,修改失敗的話註意一下
  8.0版本以下:set password for root@localhost =password(‘root‘);
d)FLUSH PRIVILEGES;

MySQL服務解壓版安裝