mysql 安裝及設置


mysql下載安裝記錄

設備情況:win10,之前沒有進行過mysql安裝。
一下載:直接官網下載,https://dev.mysql.com/downloads/file/?id=490026 下載的是解壓版的。版本8.0.18 壓縮包270M左右。下載完之后解壓。

二安裝 : 參照 https://www.runoob.com/mysql/mysql-install.html 注意:cmd要用 【管理員權限】啟動->在這里C:\Windows\System32\cmd.exe 然后運行到mysqld -install的時候
下一步net start mysql 可能會出錯:

D:\mysql-8.0.18-winx64\bin>net start mysql
發生系統錯誤 193。

*** 不是有效的 Win32 應用程序。

這時候看這篇博客,原理好像是第一次默認安裝在c盤,需要手動刪除,然后remove一下,再次安裝,就到你的指定的目錄了。然后再net啟動,就成功了

https://blog.csdn.net/qq_35164169/article/details/77863600

 

下面是我的安裝過程;
C:\Windows\system32>d:

D:\mysql-8.0.18-winx64\bin>mysqld install
Service successfully installed.

D:\mysql-8.0.18-winx64\bin>net start mysql
發生系統錯誤 193。

*** 不是有效的 Win32 應用程序。


D:\mysql-8.0.18-winx64\bin>mysqld install
The service already exists!
The current server installed: C:\Windows\system32\mysqld MySQL

D:\mysql-8.0.18-winx64\bin>c:

C:\Windows\System32>d:

D:\mysql-8.0.18-winx64\bin>mysqld remove
Service successfully removed.

D:\mysql-8.0.18-winx64\bin>mysqld -install
Service successfully installed.

D:\mysql-8.0.18-winx64\bin>mysqld -install
The service already exists!
The current server installed: D:\mysql-8.0.18-winx64\bin\mysqld MySQL

D:\mysql-8.0.18-winx64\bin>net start mysql
MySQL 服務正在啟動 .
MySQL 服務已經啟動成功。


D:\mysql-8.0.18-winx64\bin>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.18

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

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>

到這里就安裝完成了,且完成了登錄。

 

 

 


cd D:\mysql-8.0.18-winx64\bin

Xkm?o-<aR4d=

D:\mysql-8.0.18-winx64\bin>
D:\mysql-8.0.18-winx64\bin>mysqld --initialize --console
2019-10-28T00:52:20.344670Z 0 [System] [MY-013169] [Server] D:\mysql-8.0.18-winx64\bin\mysqld.exe (mysqld 8.0.18) initializing of server in progress as process 12956
2019-10-28T00:52:21.724707Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: Xkm?o-<aR4d=


D:\mysql-8.0.18-winx64\bin>mysqld --initialize --console
2019-10-28T00:58:45.711083Z 0 [System] [MY-013169] [Server] D:\mysql-8.0.18-winx64\bin\mysqld.exe (mysqld 8.0.18) initializing of server in progress as process 1104
2019-10-28T00:58:45.712542Z 0 [ERROR] [MY-010457] [Server] --initialize specified but the data directory has files in it. Aborting.
2019-10-28T00:58:45.712555Z 0 [ERROR] [MY-013236] [Server] The designated data directory D:\mysql-8.0.18-winx64\data\ is unusable. You can remove all files that the server added to it.
2019-10-28T00:58:45.718481Z 0 [ERROR] [MY-010119] [Server] Aborting
2019-10-28T00:58:45.719322Z 0 [System] [MY-010910] [Server] D:\mysql-8.0.18-winx64\bin\mysqld.exe: Shutdown complete (mysqld 8.0.18) MySQL Community Server - GPL.

# datadir=D:\mysql-8.0.18-winx64

 

//這個可以用 先創建用戶,然后分配權限;%可以遠程連接 修改后可以在workbench上登錄
CREATE USER 'zhangsan'@'%' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON lskj.* TO 'zhangsan'@'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;


//修改遠程登錄方法 可以在vs上使用。
ALTER USER 'zhangsan'@'%' IDENTIFIED BY '123456' PASSWORD EXPIRE NEVER;
ALTER USER 'zhangsan'@'%' IDENTIFIED WITH mysql_native_password BY '123456';
FLUSH PRIVILEGES;


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM