本文**:
無需安裝解壓版mysql包
建立選項配置
首次啟動服務
用mysqld初始化目錄
安裝後設定和測試
啟動服務錯誤資訊
管理員模式開啟cmd
mysqld install
net start mysqlmysql服務正在啟動
mysql服務無法啟動
解決辦法
刪除mysql安裝主目錄下的data目錄下所有檔案
mysqld --initialize --console
c:\windows\system32> mysqld --initizlize --console
mysqld: can't change dir to 'd:\program files\mysql-8.0.12-winx64\data\' (os errno 2 - no such file or directory)
2018-08-17t01:54:27.145772z 0 [system] [my-010116] [server] d:\program files\mysql-8.0.12-winx64\bin\mysqld.exe (mysqld 8.0.12) starting as process 17876
2018-08-17t01:54:27.148482z 0 [warning] [my-010091] [server] can't create test file d:\program files\mysql-8.0.12-winx64\data\desktop-set72re.lower-test
2018-08-17t01:54:27.148571z 0 [warning] [my-010091] [server] can't create test file d:\program files\mysql-8.0.12-winx64\data\desktop-set72re.lower-test
2018-08-17t01:54:27.149798z 0 [error] [my-010172] [server] failed to set datadir to d:\program files\mysql-8.0.12-winx64\data\
2018-08-17t01:54:27.169994z 0 [error] [my-010119] [server] aborting
2018-08-17t01:54:27.172048z 0 [system] [my-010910] [server] d:\program files\mysql-8.0.12-winx64\bin\mysqld.exe: shutdown complete (mysqld 8.0.12) mysql community server - gpl.
如上述報錯的話,加上user,並記錄初始密碼
mysqld --initialize --user=root --console
c:\windows\system32>mysqld --initialize --user=root --console
2018-08-17t03:06:51.636920z 0 [system] [my-013169] [server] d:\program files\mysql-8.0.12-winx64\bin\mysqld.exe (mysqld 8.0.12) initializing of server in progress as process 7832
2018-08-17t03:06:54.218851z 5 [note] [my-010454] [server] a temporary password is generated for root@localhost: yacuodqg/6mn
2018-08-17t03:06:55.288246z 0 [system] [my-013170] [server] d:\program files\mysql-8.0.12-winx64\bin\mysqld.exe (mysqld 8.0.12) initializing of server has completed
安裝服務
mysqld install
c:\windows\system32>mysqld install
service successfully installed.
啟動服務
net start mysql
c:\windows\system32>net start mysql
mysql 服務正在啟動 .
mysql 服務已經啟動成功。
登陸系統
如登陸不上,需要執行net stop mysql,
然後重新執行下mysqld --initialize --user=root --console
mysql -u root -p
c:\windows\system32>mysql -u root -p
enter password: ************
welcome to the mysql monitor. commands end with ; or \g.
your mysql connection id is 8
server version: 8.0.12
oracle is a registered trademark of oracle corporation and/or its
affiliates. other names may be trademarks of their respective
owners.
type 'help;' or '\h' for help. type '\c' to clear the current input statement.
mysql>
修改密碼
alter user 'root'@'localhost' identified by 'fjdoe13232'; mysql執行語句一定要以;結尾。切記。
mysql> alter user 'root'@'localhost' identified by 'fjdoe13232
';query ok, 0 rows affected (0.11 sec)
常用命令
show databases;
mysql> show databases;
+--------------------+
| database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.01 sec)
mysql>
create database 資料庫;
mysql> create database ustest;
query ok, 1 row affected (0.03 sec)
mysql> show databases;
+--------------------+
| database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
| ustest |
+--------------------+
5 rows in set (0.00 sec)
mysql> use ustest;
database changed
以上是簡單環境配置。 Window環境下的內網NTP時間同步配置
ip 192.168.0.1 ntp伺服器 ip 192.168.0.2 業務伺服器 ip 192.168.0.3 業務伺服器 ip 192.168.0.4 業務伺服器 多台業務伺服器指向一台ntp伺服器,實現三颱業務伺服器與第一台ntp伺服器時間同步。檢視ntp伺服器當前時間。net time 1...
Window 下 MySQL 環境的安裝
mysql 是最流行的關係型資料庫管理系統,在web應用方面 mysql 是最好的rdbms relational database management system 關聯式資料庫管理系統 應用軟體之一。我選擇它的幾點原因 體積小,速度快 免費,源 開源,跨平台 使用者量大,遇到問題容易找到解決方...
Window下mysql環境配置問題整理
無需安裝解壓版mysql包 建立選項配置 首次啟動服務 用mysqld初始化目錄 安裝後設定和測試 啟動服務錯誤資訊 管理員模式開啟cmd mysqld install net start mysql mysql服務正在啟動 mysql服務無法啟動 解決辦法刪除mysql安裝主目錄下的data目錄下...