Sida loo Oggolaan Xiriirinta Fog ee MySQL
Haddii aad la shaqaynayso xogta MySQL(MySQL database) , markaa waxaad horayba uga warqabtay caqabadaha kaa hor imanaya ilaalinta xogtaada mid sugan. Laga soo bilaabo isku dayga jabsiga xogta ee la isticmaalayo irbado SQL si xoog loo weeraro, way adagtahay in la ilaaliyo xogtaada, gaar ahaan haddii aad meel fog ka shaqaynayso database.
Waxaa jira siyaabo lagu habeeyo server-ka SQL si loo oggolaado isku-xirnaanta fog, laakiin waxaad u baahan tahay inaad taxaddar muujiso, maadaama u oggolaanshaha isku-xirnaanta fog ee server-ka MySQL waxay ka dhigi kartaa xogtaada bartilmaameed sahlan oo loogu talagalay hackers. Haddii aad rabto inaad u oggolaato isku xirka aaminka ah, fogaanta xogta MySQL , waa kuwan waxaad u baahan doonto inaad ogaato.
Inta aanad bilaabin(Before You Begin)
Kahor intaadan wax isbeddel ah ku samayn xogtaada MySQL , waxaa muhiim ah inaad kaydiso xogtaada(backup your database) , gaar ahaan haddii aad ka shaqaynayso server-ka wax soo saarka (server si firfircoon loo isticmaalo). Isbeddel kasta oo aad ku samayso kaydka xogtaada, ama server-ka martigelinaya, waxay keeni kartaa lumis xog halis ah haddii ay wax qaldamaan.
Waxa kale oo aad ogaan kartaa in isbeddelada ku yimaada isku xirka serfarkaaga ay kaa hor istaagi karaan inaad gasho ka dib. Haddii tani dhacdo, waxaad u baahan kartaa inaad la tashato maamulaha serverka si aad u hesho taageero dheeraad ah. Fikrad wanaagsan ayaa ah inaad tijaabiso isbeddel kasta oo ku yimaada server-ka MySQL ee maxalli ah si aad u hubiso haddii isbeddeladaadu shaqeeyaan ka hor intaadan isku dayin meel fog.
Waxa kale oo ay u badan tahay in haddii aad isbeddel ku samaynayso server-ka fog, aad u baahan doonto hab nabdoon oo aad ku xidhidhdo oo aad isbeddel ku samayso. SSH (Secure Shell) inta badan waa habka ugu wanaagsan ee tan lagu sameeyo, maadaama ay kuu ogolaato inaad ku xidho server-kaaga fog. Waxa kale oo aad isticmaali kartaa SSH si aad ugu xidho server-yada shabakada degaankaaga, sida kuwa lagu hayo Raspberry Pi(hosted on a Raspberry Pi) .
Hagahan ayaa ku hogaamin doona talaabooyinka habaynta MySQL si loogu ogolaado isku xidhka fog, laakiin waxaad u baahan doontaa inaad hubiso inaad si toos ah ama fog u galiso serferka martigelinaya serverka MySQL marka hore.
Ka soo qaad(Suppose) inaadan marin fog u lahayn server-kaaga SSH (tusaale ahaan). Xaaladdaas, ma awoodi doontid inaad habayso xogta MySQL si aad u oggolaato xidhiidhada fog si toos ah ilaa koontada mySQL ee xididku ay hore u ogolaato isku-xirno fog. Markaa, waxaad u baahan doontaa inaad samayso xidhiidhkan marka hore ka hor intaadan sii wadin.
Tafatirka faylkaaga qaabaynta MySQL(Editing Your MySQL Configuration File)
Tallaabada ugu horreysa ee habaynta MySQL si loogu oggolaado isku-xirnaanta fog waa in la beddelo faylka qaabeynta MySQL . Marxaladdan, hagahan waxa uu u qaadan doonaa in aad mar hore ku xidhatay server-ka, PC, ama Mac oo meel fog ku martigelinaya xogtaada mySQL oo aad marin u leedahay konsole.
Haddii kale, waxaad u habeyn kartaa server MySQL ah adiga oo isticmaalaya terminalka furan ee Mac ama Linux ama tifaftiraha qoraalka ee Windows .
- Si aad u bilowdo, isticmaal tifaftiraha qoraalka konsole ee aad doorbidayso si aad u saxdo faylkaaga xogta MySQL . Linux , ku qor sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf gudaha terminal ama daaqada SSH si aad u saxdo faylkan adoo isticmaalaya tifaftiraha (SSH)nano (iyadoo loo maleynayo in MySQL database uu ku yaal goobta caadiga ah) .
- Haddii aad ku shaqaynayso Windows , fur File Explorer oo gal gal galka uu ku jiro rakibaada MySQL (tusaale. C:/Program Files/MySQL/MySQL Server 8.0 ). Fur faylka my.ini adiga oo isticmaalaya tifaftiraha qoraalka caadiga ah (tusaale. Notepad ) adiga oo laba jeer gujinaya gelitaanka Haddii aysan jirin, samee faylka marka hore(create the file first) .
- On Mac , fur daaqad terminal oo ku qor sudo nano /usr/local/etc/my.cnf . Kani waa faylka qaabeynta caadiga ah ee MySQL haddii aad ku rakibtay MySQL adoo isticmaalaya homebrew(using homebrew) .
Goobaha sare lagu tilmamaay waa meelaha ugu talagalka ah ee faylasha qaabeynta MySQL . Haddii amarradani shaqayn waayaan, waxaad u baahan doontaa inaad raadiso faylasha khuseeya ( my.cnf , mysqld.cnf , ama my.ini ) si aad u heshid dariiqa faylka ku habboon.
Dejinta Ciwaanka-Bind-Cinwaanka Badbaadada ah ee Range(Setting a Safe Bind-Address IP Range)
- Markaad furto faylka qaabeynta MySQL ee server-kaaga, isticmaal furaha fallaadhaaga kiiboodhka si aad u gaadho qaybta (MySQL)xidhidhiyaha(bind-address) ee faylka. Kala duwanaanshahan IP-ga ayaa xaddidaya isku xirka xogtaada, kaas oo sida caadiga ah loo dejiyay inuu oggolaado oo keliya xidhiidhada mishiinka ama serverka deegaanka ee isticmaalaya 127.0.0.1 .
- Haddii aad rabto inaad habayso xogtaada MySQL si aad ugu oggolaato xidhiidhada aaladaha isticmaalaya xidhiidhkaaga internet-ka ee hadda, hel cinwaankaaga guud ee IP(find your public IP address) marka hore, ka dibna ku beddel 127.0.0.1 ciwaanka IP-gaas. Haddii kale, ku beddel ciwaanka IP-ga ee aaladda ama server-ka aad rabto inaad u oggolaato xidhiidhada.
- Xaaladaha qaarkood, waxaa laga yaabaa inaad rabto inaad u ogolaato dhammaan(all) xidhiidhada fog ee xogta MySQL . Tani waxay xanbaarsan tahay khatar aad u daran(extreme risk) mana aha in lagu isticmaalo serfarka wax soo saarka. Haddii aad rabto inaad tan ogolaato, si kastaba ha ahaatee, ku beddel 127.0.0.1 0.0.0.0 .
- Xusuusnow qiimaha dekedda ee qaybta (port )Settings aasaasiga(Basic Settings) ah. Tan waxaa looga baahan doonaa qaybta xigta. Haddii aysan muuqan, qiimaha caadiga ah ayaa la isticmaali doonaa, kaas oo ah dekedda 3306 . Waxaad ku dari kartaa deked adiga kuu gaar ah adigoo ku qoraya port = xxxx khad cusub, adigoo ku bedelaya xxxx qiimo deked ku haboon.
- Markaad dejiso bind-cinwaanka(bind-address ) faylka qaabeynta MySQL , kaydi faylka. Haddii aad ku jirto Linux , dooro Ctrl + O iyo Ctrl + X si tan loo sameeyo. On Mac, dooro Command + O iyo Command + X . Isticmaalayaasha Windows waxay wax badbaadin karaan iyagoo dooranaya File (Save)>(File ) Keyd .
- Marka xigta, isticmaalayaasha Linux iyo Mac waxay dib u bilaabi karaan MySQL iyagoo ku qoraya mysql.server stop && mysql.server start ama mysql.server dib u bilow(mysql.server restart) . Waxaa laga yaabaa inaad u baahato inaad sare u qaaddo amarka adoo isticmaalaya sudo(using sudo) (tusaale sudo mysql.server dib u bilaabay(sudo mysql.server restart) ) oo isticmaal dariiqa ku haboon faylka mysql.server ( /usr/local/bin/mysql.server ).
- Haddii amarka kore aanu shaqayn, isku day sudo service mysql(sudo service mysql restart ) beddelkeeda.
- Si aad dib ugu bilowdo MySQL gudaha Windows , fur daaqad cusub oo PowerShell ah adiga oo midigta gujinaya Start menu oo dooranaya Windows PowerShell (Admin) . Daaqadda PowerShell, ku qor net stop mysql80 oo ay ku xigto net start mysql80 , ku beddel mysql80 magaca adeega saxda ah ee kombayutarkaga.
Haddii aadan hubin magaca adeegga saxda ah ee Windows , ku qor net start si aad u hesho. Haddii aadan dib u soo dejin karin qaabeyntaada, dib u bilow server-kaaga oo dib ugu soo deji MySQL gacanta (haddii loo baahdo) beddelkeeda.
Habaynta Dab-damiskaaga(Configuring Your Firewalls)
Marxaladdan, xogtaada MySQL waa inay u oggolaataa xiriirinta fog ee aaladaha isticmaalaya ciwaanka IP-ga ee aad u dejisay sida qiimaha bind-cinwaanka(bind-address) ee faylka qaabeynta MySQL (ama dhammaan aaladaha haddii aad qiimahan u dejiso 0.0.0.0(0.0.0.0) beddelkeeda). Si kastaba ha ahaatee, xidhiidhada weli waa la xannibi doonaa qalabkaaga ama firewall network(device or network firewall) .
Inta badan server-yada iyo kombuyuutarrada waxay isticmaalaan firewall si ay u xannibaan isku xirka ilaa gelitaanka deked gaar ah mooyee. Tillaabooyinka lagu habeynayo tan way kala duwanaan doonaan, iyadoo ku xiran haddii aad ku shaqeyso MySQL Windows ama Linux . Dab-damiska Mac(Mac) si caadi ah ayey u naafo yihiin, markaa uma baahnid inaad halkan ku dhammaystirto tillaabooyin dheeraad ah.
Habee Linux Firewalls(Configure Linux Firewalls)
Qaar badan oo ka mid ah server-yada Linux waxay isticmaalaan iptables sida utility-ga dab-damiska. Waxaad u habayn kartaa adiga oo raacaya tillaabooyinka hoose.
- Fur terminal ama isku xirka SSH oo ku qor (SSH)sudo iptables -A INPUT -p tcp -s XXXX -dport YYYY -j AQBAL(sudo iptables -A INPUT -p tcp -s X.X.X.X –dport YYYY -j ACCEPT) . Ku beddel XXXX ciwaanka IP-ga ee aaladda aad rabto inaad ka oggolaato isku xirka MySQL , oo(from) ku beddel YYYY qiimaha dekedda ku habboon ee faylka qaabeynta MySQL (tus. 3306 ).
- Tani waxay habayn doontaa firewall-ka si ku meel gaar ah. Haddii aad isticmaalayso server- ka Linux ee Debian ama Ubuntu , ka dhig isbedelkan mid waara adiga oo ku qoraya sudo netfilter-sistent save(sudo netfilter-persistent save) and sudo netfilter-resstent reload galka(sudo netfilter-persistent reload ) terminalka ama daaqada SSH.
Haddii iptables aysan ahayn aaladda dab-damiska ee qaybinta Linux , waxaad u baahan doontaa inaad la tashato buug-gacmeedka isticmaale ee qaybinta wixii macluumaad dheeraad ah. Haddii xirmooyinka qaarkood (sida netfilter-persistent ) aan la heli karin, isticmaal agabka kaydinta software-ka qaybintaada si aad ugu rakibto (tusaale sudo apt install netfilter-persistent ).
Habee Windows Firewalls(Configure Windows Firewalls)
Haddii aad isticmaalayso Windows PC ama server si aad u martigeliso xogtaada, waxaad u habayn kartaa firewall kaaga adigoo isticmaalaya tillaabooyinkan:
- Midig ku dhufo(Right-click) menu- ka Start oo dooro Run .
- In sanduuqa Run , ku qor wf.msc oo dooro OK .
- Daaqadda difaaca Windows, dooro Xeerarka gudaha (Windows Defender)>(Inbound Rules ) Xeer cusub(New Rule) .
- Daaqadda Wizard Rule(New Inbound Rule Wizard) ee Cusub , dooro Dekedda(Port ) > Xiga(Next) .
- Liiska soo socda, ka dooro TCP xulashooyinka, ku qor 3306 (ama qiimaha deked kasta oo ku qoran faylka qaabeynta MySQL ), ka dibna dooro (MySQL)Next .
- Meejka Action- ka, ka tag ikhtiyaarka caadiga ah si aad u oggolaato isku xidhka(Allow the connection) , ka dibna dooro Next .
- Xaqiiji in aad rabto in sharcigu ku dhaqmo dhammaan noocyada shabakadaha, ka dibna dooro Next .
- Ku qor magaca qeexan ee qaanuunka (tusaale MySQL ) dekedda lagu siiyay, ka dibna dooro dhame(Finish) si aad ugu darto liiskaaga xeerarka dab-damiska.
Haddii ay dhibaato kaa haysato isku xidhka, ku celi tillaabooyinkan sare, adigoo hubinaya inaad abuurto xeer cusub oo dibadda(outbound rule ) ka baxaya goobaha dab-damiska adiga oo isticmaalaya isla faahfaahinta (dekedda 3306, iwm). Waxa kale oo laga yaabaa inaad u baahato inaad habayso routerkaaga deegaanka si aad u furto dekedaha xidhan ee lagama maarmaanka(open the necessary blocked ports) u ah si ay ugu ogolaato xidhidh gudaha iyo dibadda ah ee xogtaada.
Ku xidhida Server Fog Isticmaalka MySQL(Connecting to a Remote Server Using MySQL)
Ka dib markii la habeeyo xogta MySQL si aad u oggolaato xidhiidhada fog, waxaad u baahan doontaa inaad dhab ahaantii xiriir la sameyso. Waxaad taas ku samayn kartaa adiga oo isticmaalaya amarka mysql ( mysql.exe ee Windows ) ka daaqada terminal ama PowerShell .
Haddii aad ku shaqeyneyso Windows , waxaad u baahan doontaa inaad hubiso in MySQL lagu rakibay gudaha(MySQL is installed locally) ka hor intaadan bilaabin. Isticmaalayaasha Mac(Mac) waxay ku rakibi karaan MySQL iyagoo isticmaalaya homebrew(using homebrew) laga soo bilaabo terminalka ( brew install mysql ), halka isticmaalayaasha Linux ay isticmaali karaan kaydinta app-ka maxalliga ah (tusaale sudo apt install mysql ) si ay u rakibaan xirmooyinka lagama maarmaanka ah.
Ku xidhida MySQL ee Linux ama Mac(Connecting to MySQL on Linux or Mac)
- Si aad ugu xidho server- kaaga fog ee MySQL ee (MySQL)Mac ama Linux , fur daaqad cusub oo terminal ah oo ku qor mysql-u username -h XXXX:XXXX-p . Ku beddel XXXX:XXXX oo ku beddel ciwaanka IP-ga ee fog ee server-kaaga iyo lambarka dekedda (tusaale. 100.200.100.200:3306 ) iyo magaca isticmaale(username) ee MySQL.
- Marka lagu weydiiyo, xaqiiji furahaaga Haddii xiriirku guuleysto, fariinta guusha ayaa ka soo muuqan doonta terminalka.
Ku xidhida MySQL ee Windows(Connecting to MySQL on Windows)
- Si aad ugu xidho server-ka fog ee MySQL ee (MySQL)Windows , fur daaqad cusub oo PowerShell ah adiga oo midigta gujinaya menu-ka Start oo dooranaya Windows PowerShell (Admin) .
- Daaqadda cusub ee PowerShell, ku qor cd “C:\Program Files\MySQL\MySQL Workbench 8.0\ ” si aad u geliso galka saxda ah, adigoo ku beddelaya tusahan hagaha rakibaadda saxda ah ee kombayutarkaga. Tusaale ahaan, haddii nooca MySQL yahay 8.0.1, isticmaal MySQL Workbench 8.0.1 galka beddelka.
- Halkaas, ku qor .\mysql.exe -u username -h X.X.X.X:XXXX -p . Ku beddel XXXX:XXXX oo ku beddel cinwaankaaga IP-ga ee fog ee server-kaaga iyo lambarka dekedda (tusaale. 100.200.100.200:3306 ) iyo magaca isticmaale(username) ee MySQL oo u oggolaanaya gelitaanka fog (sida xididka(root) ). Raac(Follow) tilmaamaha dheeraadka ah ee shaashadda.
- Bixi eraygaaga sirta ah, marka lagu soo jeediyo, si aad u dhamaystirto habka gelida oo aad meel fog uga gasho xogtaada MySQL .
Haddii tani aysan shaqayn, ku xir server-ka ama PC-ga martigelinaya server-kaaga MySQL adoo isticmaalaya SSH (ama si toos ah u gal) adoo isticmaalaya tillaabooyinkan oo isticmaalaya doodda- h localhost . Markaa waxaad samayn kartaa akoon isticmaale oo kugu habboon adiga oo raacaya tillaabooyinka hoose.
Oggolaanshaha Isticmaalaha Fog ee Gelitaanka Xogta MySQL(Allowing Remote User Access to a MySQL Database)
Halkaa marka ay marayso, waa in aad awood u yeelatid in aad ku xidho server-kaaga MySQL meel fog adoo isticmaalaya koontada isticmaalaha xididka ee server-kaaga ama akoon kale oo isticmaale leh oo leh mudnaanta sare. Maadaama heerkan gelitaankani aanu badbaado lahayn, waxa laga yaabaa inaad door bidayso inaad abuurto akoon ka xaddidan gelitaanka xogta MySQL .
Koontadan waxa ay yeelan doontaa galaangal xaddidan oo ah server-kaaga MySQL , taas oo u oggolaanaysa in ay la falgasho xogaha la doortay oo keliya. Ma awoodi doonto inay samayso isbeddello halis ah, sida gelitaanka xogta kale ee xogta, abuurista akoonnada isticmaalaha cusub, iwm.
Waxaad u baahan doontaa inaad awood u yeelato inaad si fog u gasho server- kaaga MySQL . Haddii aadan isticmaali karin akoonkaaga xididka meel fog, waxaad u baahan doontaa inaad gasho qolofka server-kaaga adoo isticmaalaya taliska mysql adoo isticmaalaya xiriir (mysql)SSH fog ama adoo si toos ah u galaya kombuyuutarka ama serverka martigeliyaha serverka.
- Qolkaaga MySQL(MySQL) ee fog (adoo isticmaalaya aaladda mysql ), ku qor CREATE USER “username”@”x.x.x.x” IDENTIFIED BY “password”; oo dooro Geli(Enter) . Ku beddel isticmaale magaca(username ) isticmaale ee aad rabto inaad abuurto, xxxx ku beddel ciwaanka IP-ga ee aad doonayso inaad ku xidho, iyo furaha sirta(password) ah ee ku habboon.
- Waxaad u baahan doontaa inaad siiso akoonkaaga cusub ogolaanshaha lagama maarmaanka ah. Si aad tan u samayso, ku qor GRANT ALL ON databasename.* TO username@”x.x.x.x”; oo ku beddel magaca database, username,(databasename, username, ) iyo xxxx faahfaahinta saxda ah. Haddii aad rabto, ku beddel magaca database-(databasename) ka * si aad u hesho dhammaan xogta macluumaadka.
Helitaanka la oggolaaday, isticmaal tillaabooyinka qaybta sare si aad meel fog ugu xidho serverkaaga adiga oo isticmaalaya akoonkaaga cusub (tusaale mysql -u username -h XXXX:XXX-p(mysql -u username -h X.X.X.X:XXXX -p) ).
Sugidda Xogtaada Xogta(Securing Your Database Data)
Haddi aad la shaqaynayso MySQL ama nooc kale oo xogta SQL ah, waxa muhiim ah in aad xidhidhkaaga ilaaliso si aad u ilaaliso amaanka xogtaada. Habka ugu wanaagsan ee tan loo sameeyo waa in la dhaliyo furayaasha SSH si aad u hesho meel fog(generate SSH keys for remote access) server-kaaga, halkii aad ku tiirsanaan lahayd furaha sirta ah ee duugoobay (oo si fudud loo qiyaasi karo).
Haddii aad ka welwelsan tahay luminta xogta, waxaad si fudud u kaydin kartaa xogtaada(back up your database) internetka. Inta badan xog-ururinta waxa lagu maamulaa adeegayaasha Linux -waxaad si fudud u samayn kartaa kaydinta faylka Linux(automate a Linux file backup easily) . Haddii aad MySQL ku shaqaynayso Windows , waxaad u samayn kartaa nidaam gurmad otomaatig ah oo la mid ah Windows(automatic backup system for Windows) , kaasoo kuu oggolaanaya inaad soo celiso xogtaada xaalad degdeg ah.
Related posts
Sida Loo Joojiyo Xidhiidhada Fog ee Kumbuyuutarka Windows ama Mac
Sida dib loogu dajiyo fogaanta TV-ga Dabka
Isku-xidhka Isku-xidhka Buundada ee Windows 7/8/10
Sida Looga Habeeyo Mishiinka Fog ee Router-ka
Kahortagga Badbaadinta Aqoonsiga Desktop-ka Fog ee Daaqadaha
Isla markiiba ka saar asalka sawirada adoo isticmaalaya AI
Sida loo damiyo Furaha Daaqadaha
Dib-u-eegis Buugaag - Hagaha sida-Geek-ga loo barto ee Windows 8
Sida Warshada dib loogu habeeyo Xbox One ama Xbox Series X
Sida loo sameeyo boggaga Master-ka ee Adobe InDesign CC
Sida Loo Ilaaliyo PC-gaaga Daaqadaha Adigoon taaban Jiirka
Sida Loo Isticmaalo Shabakadda Gaarka Loo Leeyahay ee Firefox si aad Naftaada uga Ilaaliso Online
Sida Loo Bedelo Disk Dynamic Disk-ga Aasaasiga ah
Sida loo digitize DVD-yada
Demi Koontaroolada Koontada Isticmaalaha (UAC) ee Codsi Gaar ah
Sida loo furo faylasha DDS gudaha Windows 10
Sida loo ilaaliyo erayga sirta ah PDF si uu ammaan u ilaaliyo
Sida Loo cusboonaysiiyo Software-kaaga PC si toos ah
Sida Loo Arkiyo Bogagga Cajiska Ah Iyo Faylasha Ka Soo Baxa Browserkaaga
Sida Sawirada WEBP loogu beddelo JPG, GIF, ama PNG