Yuav Paub
- Enter CREATE USER 'wordpress_db_user'@'localhost' IDENTIFIED BY 'L!f3W!r3';
- Substitute wordpress_db nrog lub npe database thiab L!f3W!r3 nrog tus neeg siv lub npe nyiam.
- Tom ntej no, nkag mus PAUB TAG NRHO COV TSEV KAWM NTAWV NTAWM wordpress_db. TO > nkag mus rau database thiab tus neeg siv lub npe.
Kab lus no piav qhia yuav ua li cas los tsim cov neeg siv thiab tso cai rau hauv MySQL. Cov lus qhia siv rau txhua lub platform xws li Windows, Mac, thiab Linux.
Create a MySQL Database
Thaum koj nruab ib lub platform zoo li Wordpress, nws yuav tsum muaj database (feem ntau yog MySQL database). Thaum lub sijhawm teeb tsa ntawm lub kaw lus zoo li Wordpress, koj yuav raug nug kom muab:
- Lub npe ntawm cov ntaub ntawv siv los siv.
- Tus neeg siv lub npe nrog kev tso cai nkag mus rau hauv database.
- Tus password rau tus neeg siv uas nkag tau rau hauv database.
Thaum lub sijhawm teeb tsa ntawm MySQL database, koj yuav raug nug kom tsim tus password rau tus neeg siv admin. Tej zaum koj yuav nug koj tus kheej, "Vim li cas tsis yog siv tus neeg siv admin rau cov txheej txheem no?" Cov lus teb yog yooj yim: kev ruaj ntseg. Tus neeg siv MySQL yuav tsum tsuas yog siv los tswj hwm MySQL database server thiab nws cov neeg siv, tsis yog tus account rau kev teeb tsa ntawm cov software thib peb. Txog qhov kawg, koj yuav tsum tsim kom muaj cov neeg siv tshiab thiab tso cai rau cov neeg siv tshiab nkag mus rau cov ntaub ntawv tshwj xeeb thib peb. Piv txwv li, yog tias koj tab tom txhim kho Wordpress, koj tuaj yeem tsim cov hauv qab no:
- Database: wordpress_db
- User: wordpress_db_user
Koj mam li tsim tus password rau wordpress_db_user thiab tso cai rau tus neeg siv nkag mus rau qhov wordpress_db database.
Cia peb mus tom ntej thiab tsim cov ntaub ntawv. Nov yog cov kauj ruam:
-
Nkag mus rau MySQL tam sim nrog cov lus txib:
mysql -u root -p
-
Ntaus tus MySQL admin lo lus zais thiab siv Enter/Return ntawm koj cov keyboard.
Tsim cov ntaub ntawv nrog cov lus txib
CREATE DATABASE wordpress_db;
(sub "wordpress_db"
-
Flush cov cai database nrog cov lus txib
FLUSH PRIVILEGES;
-
Tawm tawm ntawm MySQL kom nrog cov lus txib
tawm
Tsim tus neeg siv hauv MySQL
Nrog cov ntaub ntawv nyob rau hauv qhov chaw, tam sim no koj tuaj yeem tsim tus neeg siv uas yuav nkag mus rau cov ntaub ntawv tshiab tsim. Qhov no kuj tau ua los ntawm MySQL kom sai. Txhawm rau tsim tus neeg siv tshiab no, ua raws cov kauj ruam no:
-
Nkag mus rau MySQL sai nrog cov lus txib
mysql.exe -u -p
-
Ntaus tus MySQL admin lo lus zais thiab siv Enter/Return ntawm koj cov keyboard.
Tsim tus neeg siv nrog cov lus txib
CREATE USER 'wordpress_db_user'@'localhost' IDENTIFIED BY 'L!f3W!r3';
(hloov "wordpress_db_user" thiab "L!f3W!r3"
- Flush cov cai database nrog cov lus txib
- Tawm tawm ntawm MySQL kom nrog cov lus txib
Grant Permission in MySQL
Tam sim no peb yuav tsum tso cai rau qhov tsim tshiab wordpress_db_user tso cai nkag mus rau qhov tsim tshiab wordpress_db database. Qhov no ua tiav nrog cov kauj ruam hauv qab no:
-
Nkag mus rau MySQL sai nrog cov lus txib
mysql.exe –u –p
-
Ntaus tus MySQL admin lo lus zais thiab siv Enter/Return ntawm koj cov keyboard.
Muab rau tus neeg siv nkag nrog cov lus txib hauv qab no
PAUB TXHUA TXHUA YAM RAU wordpress_db. TO 'wordpress_db_user'@'localhost' IDENTIFIED BY 'L!f3W!r3';.
(hloov wordpress_db, wordpress_db_user, thiab L!f3W!r3
-
Flush cov cai database nrog cov lus txib
FLUSH PRIVILEGES;
-
Tawm tawm ntawm MySQL kom nrog cov lus txib
tawm
Lub sijhawm no, tus neeg siv hauv zos wordpress_db_user muaj kev nkag mus rau tag nrho wordpress_db database. Yog li thaum koj mus rau nruab Wordpress (los yog txhua yam server software koj npaj siab yuav nruab), koj tuaj yeem siv wordpress_db_userua tus siv database thiab L!f3W!r3raws li tus password.
Granting remote access
Muaj ib qho teeb meem. Cov kev tso cai saum toj no tsuas yog ua haujlwm rau wordpress_db_user ntawm lub tshuab hauv zos. Yuav ua li cas yog tias koj nyob nraum database yog nyob rau ntawm ib tug tej thaj chaw deb server? Rau qhov ntawd, koj yuav tsum hloov pauv GRANT ALL PRIVILEGES hais kom ua. Cia peb hais tias lub tshuab koj tab tom txhim kho Wordpress (lossis txawm li cas los xij thib peb tus neeg rau zaub mov software) nyob ntawm IP chaw nyob 192.168.1.100. Txhawm rau muab wordpress_db_user kev tso cai nkag mus rau hauv cov ntaub ntawv los ntawm lub tshuab ntawd, tus tshiab GRANT ALL PRIVILEGES cov lus txib yuav zoo li no:
PAUB TXHUA TXHUA YAM RAU wordpress_db. TO 'wordpress_db_user'@'192.168.1.100' IDENTIFIED BY 'L!f3W!r3';
Raws li koj tuaj yeem pom, tsis yog tso cai nkag mus rau tag nrho wordpress_db ntawm localhost, qhov peb tau ua yog pub rau wordpress_db_user neeg siv ntawm tej thaj chaw deb tshuab 192.168.1.100 tag nrho nkag mus rau wordpress_db database. Cov lus txib ntawd yuav ua rau koj tuaj yeem nruab Wordpress (lossis lwm tus neeg siv software software koj xav tau) ntawm tus neeg rau zaub mov ntawm IP chaw nyob 192.168.1.100 thiab kom nws nkag mus rau wordpress_dbMySQL database, as the wordpress_db_user