Maitiro ekuisa MySQL 5.7 paLinux CentOS uye Ubuntu

Maitiro ekuisa MySQL 5.7 paLinux CentOS uye Ubuntu

MySQL ndeye yakavhurwa sosi inoratidzira dhatabhesi manejimendi sisitimu yakagadzirirwa neOracle mubatanidzwa. Iyo kodhi kodhi inoburitswa pasi peGNU General Public License, uye kune yekambani, pane yakabhadharwa vhezheni inopa mamwe mabasa. MySQL chinhu chakakosha chezvikamu zveRAMP uye LEMP. Mazhinji mashandisirwo anoshandisa matura aya neMySQL sisitimu yedhatabhesi.

Muchidzidzo ichi, ini ndinokutungamira maitiro ekuisa uye kugadzirisa iyo nyowani yakagadzika MySQL 5.7 vhezheni pane CentOS 7 server uye Ubuntu 16.04 server.

Pazasi ndizvo zvatichaita nekuda kwechinangwa ichi.

  1. Wedzera nyowani nyowani ine yazvino MySQL vhezheni.
  2. Isa MySQL 5.7 yakagadzikana vhezheni.
  3. Wedzera MySQL kunguva yebhoti.
  4. Dzorerazve default MySQL midzi password.
  5. Kuedza kugadzira mushandisi mutsva uye dhatabhesi.

Nhanho 1 - Wedzera Nyowani Repository

MySQL inopa repository kune akati wandei kugoverwa kweLinux kusanganisira rpm uye madhi anogoverwa kugoverwa uko kune yazvino yakagadzikana MySQL kuburitswa. Saka isu tinofanirwa kuwedzera nyowani MySQL repository kune system kuti ienderere mberi.

Wedzera iyo nyowani nyowani yeMySQL kune iyo CentOS 7 server neiyi yum yekuraira.

yum localinstall https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm

Iwe unozobvunzwa kuti uwedzere nyowani nyowani, mhando 'y'uye pfuurira'pinda'kusimbisa.

Wedzera nyowani mysql repository kune iyo centos system

ZveUbuntu, dhawunirodha iyo MySQL deb package repository faira uye riise pamwe neiyo dpkg rairo uye wozogadziridza repository.

wget https://dev.mysql.com/get/mysql-apt-config_0.8.3-1_all.deb
dpkg -i mysql-apt-config_0.8.3-1_all.deb
Apt-get update

Pakati pepakeji yekuisa, iwe uchazobvunzwa iyo MySQL vhezheni yaunoda kuisa uye ndeapi mamwe maMySQL maturusi aunoda kuisa. Ini ndinosiya zvese zvisipo, saka ingosarudza 'Ok'uye pfuurira'pinda'.

Wedzera Nyowani MySQL Repository kuUbuntu System

Iyo nyowani nyowani yakawedzerwa kune iyo system.

Nhanho 2 - Isa MySQL 5.7

Iyo nyowani MySQL repository inowanikwa pane system izvozvi uye isu takagadzirira kuisa MySQL 5.7 yazvino vhezheni yakagadzika kubva kuichengetedzo. Iri pasuru zita 'mysql-nharaunda-server'.

PaCentOS, isa 'mysql-nharaunda-server' ne yum.

yum -y kuisa mysql-nharaunda-server

ZveUbuntu, ndapota shandisa uyu apt kuraira.

apt-tora kuisa -y mysql-nharaunda-server

Cherechedza:

PaUbuntu, iwe unozobvunzwa nyowani MySQL midzi password, nyora mukati uye dzokorora yakasimba password.

Tora MySQL midzi password

Nyorazve pasiwedhi yako.

Re-nyora MySQL midzi password

MySQL 5.7 yakaiswa.

Nhanho 3 - Tanga MySQL uye Enable Kutanga paBoot Nguva

Mushure mekuisa MySQL, tanga iyo uye wedzera MySQL kuti utange panguva yebhoti otomatiki neiyo systemctl yekuraira.

Ye CentOS server shandisa 'mysqld' sevhisi.

systemctl kutanga mysqld
systemctl ipai mysqld

ZveUbuntu tinogona kushandisa 'mysql' sevhisi.

systemctl tanga mysql
systemctl ipai mysql

MySQL yakatanga, iri kushandisa chiteshi 3306 yekubatana, unogona kutarisa kuti pane ese Ubuntu uye Centos server ine netstat yekuraira.

netstat -plntu

Kana iwe uchida kutarisa kuti iyo mysql sevhisi inotanga otomatiki panguva yebhoti kana kwete, unogona kushandisa is-inogoneswa sarudzo pazasi.

YeCentOS.

systemctl inogoneswa mysqld

Kutanga uye Wedzera kune iyo Boot nguva MySQL sevhisi

YeUbuntu.

systemctl inogoneswa mysql

Kutanga uye Wedzera kune iyo bhuti nguva MySQL sevhisi

akwanise mhedzisiro = sevhisi inowedzerwa kutanga panguva yebhoti.

Nhanho 4 - Gadzira iyo MySQL Root password

MySQL 5.7 yakaiswa uye yakatanga. Sezvauri kuona, iyo MySQL midzi password yeUbuntu yakagadziridzwa panguva yekumisikidza, saka hatidi kugadzirisa kana kuseta zvakare password paUbuntu. Asi izvi hazvisizvo pane CentOS.

PaCentOS 7, MySQL ichagadzira yakasimba default password kana MySQL yatanga kekutanga, iyo default password inoratidzwa mune mysqld.log faira. Iwe unogona kushandisa iyo grep yekuraira pazasi yekuratidza iyo yakasarudzika MySQL password.

grep 'zvishoma' /var/log/mysqld.log

Iwe uchaona default MySQL midzi password, uye isu tinofanirwa kuseta nyowani default password izvozvi.

Default MySQL midzi password password CentOS 7

Unganidza kune MySQL shell neiyo default password.

mysql -u root -p
TYPE KUCHAPA PASSWORD

Zvino chinja password yekumisikidza neye nyowani uye yakasimba password, mune yangu, ini ndichaisa password '[email inodzivirirwa]'nemubvunzo weMySQL pazasi.

ALTER USER 'mudzi' @ 'localhost' IDENTIFIED BY '[email inodzivirirwa]';
flush privileges;

Iyo default password yakachinjwa.

Chinja Default MySQL midzi password paLinux

Cherechedza:

Iwe unogona kushandisa uyu mubvunzo kumisazve iyo MySQL midzi password password CentOS uye Ubuntu chero nguva gare gare futi.

Danho 5 - Kuedza

Mune ino nhanho, isu tichaedza kubatanidza kune MySQL shell ne password nyowani uye tobva tagadzira dhatabhesi nyowani uye mushandisi.

Unganidza kune MySQL shell neiyo MySQL midzi password, uchishandisa iyo 'mysql' rairo.

mysql -u root -p
TYPE ITSVA DZIDZISO: [email inodzivirirwa]

Gadzira dhatabhesi nyowani inonzi 'hakaselabs'. Ehezve, unogona kusarudza rako zita pano.

gadzira database hakaselabs;

Uye gadzira mushandisi mutsva ane zita 'hakase' uye password ndeye '[email inodzivirirwa]'(kana chero zita rekushandisa nephasiwedi iwe yaunoda kushandisa).

gadzira mushandisi [email yakachengetedzwa] inozivikanwa na '[email inodzivirirwa]';

Iye zvino ipa ropafadzo dze database nyowani kumushandisi mutsva.

ipa rombo dzese pahakaselabs. * kune [email yakachengetedzwa] inozivikanwa na '[email inodzivirirwa]';
flush privileges;

Gadzira Nyowani mushandisi, dhatabhesi uye upe mushandisi kudhatabhesi MySQL

Buda kubva kuMySQL shell uye edza kubatanidza zvakare nemushandisi mutsva.

mysql -u hakase -p
TYAI PASI PASI: [email inodzivirirwa]

Ratidza dhatabhesi runyorwa pasi pemushandisi 'hakase'.

ratidza dhatabhesi;

Iwe unogona kuona dhatabhesi inonzi 'hakaselabs'.

Kuedza kubatanidza kune mysql nemushandisi mutsva uye kuratidza database

MySQL 5.7 yakaiswa zvinobudirira, yakatangwa uye yakagadzirirwa kuti itange otomatiki panguva yebhoti. Uye isu takagadzira mushandisi mutsva uye dhatabhesi uye takabatana zvinobudirira kune MySQL shell nemushandisi wedu mutsva.

Reference

https://dev.mysql.com/doc/refman/5.7/en/linux-installation.html

mabviro