# 安裝 MySQL DB 兩種方式 ###### tags: `public` 以下以win10為例 ## ==1.XAMApp (較簡單)== https://www.apachefriends.org/zh_tw/download.html  --- ## ==2.MySQL官網 (不推薦)== a.下載安裝管理器 https://dev.mysql.com/downloads/installer/  b.添加 MySQL Server和 Workbench 輸入密碼(要記好)   c.完成安裝  d.將b步驟2個執行起來 d-1 cmd輸入密碼,正確連線後的畫面  d-2 workbench 點設定,建立連線測試   完成後回到首頁會出現連線,點開   e.建表格和欄位 參考 https://ithelp.ithome.com.tw/articles/10215161 ## 其他 express js 後端語法  ```javascript= // "dependencies": { // "express": "^4.18.1", // "mysql": "^2.18.1" // } var express = require("express"); var app = express(); app.listen(3000); var mysql = require("mysql"); var conn = mysql.createConnection({ user: "root", password: "你的密碼", host: "localhost", port: 3306, database: "class" }) app.get('/', function (req, res) { conn.connect(function (error) { if (error) { res.send(JSON.stringify(error)); } else { res.send("OK 3"); } }); }) ``` ### Mysql 解决1251- Client does not support authentication protocol requested by server.. ##### 原因 mysql8版本太新,加密模式改變 https://blog.csdn.net/lovedingd/article/details/106728292 https://waylau.com/node.js-mysql-client-does-not-support-authentication-protocol/ ##### 解決 變更加密模式 select host,user,plugin,authentication_string from mysql.user;  ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '12345678';  
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up