該系統(tǒng)使用 MySQL 數(shù)據(jù)庫(kù),MySQL 已經(jīng)安裝好。
創(chuàng)建數(shù)據(jù)庫(kù)、用戶、設(shè)置用戶權(quán)限
創(chuàng)建文件 database/init.sql, 并寫入內(nèi)內(nèi)容如下:
-- to init the database and user, use the following command
-- mysql -u root -p < init.sql
CREATE DATABASE MES DEFAULT CHARACTER SET = utf8mb4;
CREATE USER 'mes'@'localhost' IDENTIFIED BY 'mespassword';
GRANT ALL ON MES.* TO 'mes'@'localhost';
執(zhí)行這些命令:
$ mysql -u root -p < database/init.sql
在 .env 中設(shè)置數(shù)據(jù)庫(kù)
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=MES
DB_USERNAME=mes
DB_PASSWORD=mespassword