安裝
創(chuàng)建Strapi項(xiàng)目
npx create-strapi-app@latest my-project
輸入后可以選擇第一項(xiàng)快速創(chuàng)建項(xiàng)目撑蚌,第二項(xiàng)則為手動(dòng)創(chuàng)建
安裝完成后輸入以下代碼運(yùn)行項(xiàng)目
cd my-project
npm run develop
顯示連接mysql失敗
創(chuàng)建時(shí)可能會(huì)顯示連接mysql失敗
Client does not support authentication protocol requested by server; consider upgrading MySQL client
問題原因:通過相關(guān)問題查閱夯到,發(fā)現(xiàn)是由于navicat版本的問題造成連接失敗重挑。mysql8 之前的版本中加密規(guī)則是mysql_native_password,而在mysql8之后,加密規(guī)則是caching_sha2_password
解決方法
1. 進(jìn)入mysql
mysql -uroot -p
2.輸入命令修改加密規(guī)則
//localhost有時(shí)候也得修改%
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';
//ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123456';
3.刷新權(quán)限,使修改生效喊衫。
FLUSH PRIVILEGES;
4.查看表中相關(guān)信息,確認(rèn)修改是否真正生效
mysql> use mysql; //先使用命令 use mysql
Database changed
mysql> select user,host,plugin from user where user='root'; // 在輸入該命令
+------+-----------+-----------------------+
| user | host | plugin |
+------+-----------+-----------------------+
| root | localhost | mysql_native_password |
+------+-----------+-----------------------+
1 row in set (0.00 sec)
————————————————
設(shè)置中文
創(chuàng)建src\admin\app.js
const config = {
locales: ["zh-Hans"],
};
const bootstrap = (app) => {};
export default {
config,
bootstrap,
};
重啟項(xiàng)目
npm run develop