Accesarea la distanță a MySQL® permite altor servere sau dispozitive să se conecteze la baza de date MySQL de pe serverul tău cPanel. Această funcție este utilă atunci când ai nevoie ca aplicații externe sau alte servere să acceseze baza de date MySQL. Iată un tutorial pas cu pas despre cum să configurezi accesul Remote MySQL în cPanel.
Cum să configurezi accesul Remote MySQL® în cPanel
1. Autentifică-te în cPanel
- Deschide browserul și accesează cPanel folosind adresa URL specifică:
http://yourdomain.com/cpanel
- Introdu numele de utilizator și parola cPanel.
2. Accesează secțiunea "Databases"
- După ce te-ai autentificat, derulează în jos până la secțiunea Databases (Baze de date).
- Click pe opțiunea Remote MySQL®.
3. Adaugă adresa IP pentru acces la distanță
-
Pe pagina Remote MySQL, vei vedea un câmp în care poți introduce adrese IP.
-
În câmpul Add Access Host (Adaugă gazdă de acces), introdu adresa IP a serverului care va accesa baza de date MySQL de la distanță.
- Exemplu: Dacă vrei să permiți unui server extern (sau unui computer) să acceseze baza de date, introdu adresa IP publică a acelui server.
- Poți adăuga și wildcard-uri (e.g.,
192.168.0.%
) pentru a permite accesul dintr-o gamă de IP-uri.
-
După ce ai introdus adresa IP, apasă pe butonul Add Host (Adaugă gazdă).
-
Notă: Dacă nu cunoști adresa IP a dispozitivului sau serverului care va accesa MySQL, poți găsi adresa IP publică accesând WhatIsMyIP.
4. Verificarea configurării MySQL la distanță
După ce ai adăugat adresa IP la lista de gazde permise pentru acces MySQL, trebuie să te asiguri că:
-
Utilizatorul MySQL are acces corespunzător:
- Verifică dacă utilizatorul bazei de date MySQL pe care dorești să o accesezi are drepturi de acces.
- Poți face acest lucru în secțiunea MySQL Databases din cPanel, unde poți acorda drepturi specifice utilizatorilor MySQL.
-
Configurarea firewall-ului:
- Asigură-te că portul MySQL (portul implicit este 3306) este deschis în firewall-ul serverului tău. Altfel, accesul la distanță poate fi blocat.
5. Conectarea la baza de date MySQL de la distanță
Acum, după ce ai configurat accesul la distanță, poți folosi clientul sau aplicația preferată pentru a te conecta la baza de date.
- Hostname: Utilizează IP-ul serverului tău cPanel ca hostname (sau
yourdomain.com
dacă domeniul tău este configurat pentru a indica serverul). - Port: De obicei, portul este 3306.
- Username și Password: Introdu numele de utilizator și parola MySQL create anterior.
Exemplu de conexiune dintr-un client MySQL (ca phpMyAdmin, HeidiSQL sau MySQL Workbench):
Hostname: yourdomain.com (sau IP-ul serverului tău)
Port: 3306
Username: utilizator_mysql
Password: parola_mysql
Sfaturi suplimentare:
- Securitate: Deschiderea accesului MySQL la distanță poate prezenta riscuri de securitate. Este recomandat să restricționezi accesul doar la adrese IP de încredere.
- Acces limitat: Dacă serverul tău permite, folosește un VPN sau un tunel SSH pentru a proteja conexiunea la distanță.
- Gestionarea IP-urilor: Asigură-te că actualizezi regulat lista de adrese IP care au acces la baza de date MySQL, mai ales dacă acestea se schimbă frecvent.
Prin acești pași, vei putea configura accesul Remote MySQL pentru contul tău cPanel și permite altor servere să se conecteze la baza ta de date MySQL.