Try   HackMD

安裝 MySQL DB 兩種方式

tags: public

以下以win10為例

1.XAMApp (較簡單)

https://www.apachefriends.org/zh_tw/download.html

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →


2.MySQL官網 (不推薦)

a.下載安裝管理器
https://dev.mysql.com/downloads/installer/

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

b.添加 MySQL Server和 Workbench
輸入密碼(要記好)
Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

c.完成安裝
Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

d.將b步驟2個執行起來
d-1 cmd輸入密碼,正確連線後的畫面

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

d-2 workbench 點設定,建立連線測試
Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

完成後回到首頁會出現連線,點開
Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

e.建表格和欄位
參考
https://ithelp.ithome.com.tw/articles/10215161

其他

express js 後端語法

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

// "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;

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '12345678';

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →