אנדרואיד

כיצד להתקין את MySQL על Debian 10 Linux

Debian 10: Installing MySQL (not MariaDB) (non APT Repository)

Debian 10: Installing MySQL (not MariaDB) (non APT Repository)

תוכן עניינים:

Anonim

MySQL, מערכת ניהול בסיסי הנתונים הקשורה למקור פתוח הפופולרי ביותר בעולם אינה זמינה במאגרי ברירת המחדל של דביאן. MariaDB היא מערכת מסד הנתונים המוגדרת כברירת מחדל ב- Debian 10.

מדריך זה מסביר כיצד להתקין ולאבטח את MySQL ב- Debian 10 ממאגר MySQL Apt.

הגדרת מאגר MySQL

כדי להוסיף את מאגר ה- MySQL APT למערכת שלך עבור לדף ההורדה של מאגר והורד את חבילת המהדורה האחרונה באמצעות הפקודה הבאה של wget:

wget

לאחר השלמת ההורדה, התקן את חבילת השחרור כמשתמש עם הרשאות sudo:

sudo apt install./mysql-apt-config_0.8.13-1_all.deb

תוצג בפניך תפריט התצורה שממנו תוכל לבחור את גרסת MySQL שברצונך להתקין.

לאחר סיום ההתקנה, שירות MySQL יתחיל אוטומטית, תוכלו לאמת אותו על ידי הקלדה:

sudo systemctl status mysql

● mysql.service - MySQL Community Server Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: en Active: active (running) since Fri 2019-07-26 13:23:25 PDT; 37s ago…

אבטחת MySQL

הפעל את הפקודה mysql_secure_installation סיסמת השורש וכדי לשפר את האבטחה של התקנת MySQL:

sudo mysql_secure_installation

Securing the MySQL server deployment. Connecting to MySQL using a blank password. VALIDATE PASSWORD COMPONENT can be used to test passwords and improve security. It checks the strength of password and allows the users to set only those passwords which are secure enough. Would you like to setup VALIDATE PASSWORD component? Press y|Y for Yes, any other key for No:

תתבקש להגדיר את תצורת VALIDATE PASSWORD PLUGIN המשמשת לבדיקת חוזק סיסמאות משתמשי MySQL. קיימות שלוש רמות של מדיניות אימות סיסמא, נמוכה, בינונית וחזקה. לחץ על ENTER אם אינך רוצה להגדיר את תוסף הסיסמה לאמת.

Please set the password for root here. New password: Re-enter new password:

בהנחיה הבאה תתבקש להגדיר סיסמה עבור משתמש השורש MySQL.

By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? (Press y|Y for Yes, any other key for No): y Success. Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? (Press y|Y for Yes, any other key for No): y Success. By default, MySQL comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? (Press y|Y for Yes, any other key for No): y - Dropping test database… Success. - Removing privileges on test database… Success. Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? (Press y|Y for Yes, any other key for No): y Success. All done!

לאחר שתגדיר את סיסמת השורש, הסקריפט יבקש ממך להסיר את המשתמש האנונימי, להגביל את הגישה של משתמש השורש למחשב המקומי ולהסיר את מסד הנתונים הבדיקה. עליכם לענות על “Y” (כן) לכל השאלות.

מתחבר לשרת MySQL

כדי ליצור אינטראקציה עם MySQL דרך הטרמינל, השתמש בלקוח mysql המותקן כתלות בחבילת שרת MySQL.

אם בחרת בשיטת האימות המוגדרת כברירת מחדל כדי להיכנס לשרת MySQL כסוג משתמש השורש:

sudo mysql

אחרת, אם בחרת בשיטת האימות מדור קודם כדי להתחבר:

mysql -u root -p

תתבקש להזין את סיסמת השורש mysql_secure_installation בעבר כאשר mysql_secure_installation סקריפט mysql_secure_installation . לאחר שתזין את הסיסמה תוצג בפניך פגז ה- MySQL כמוצג להלן:

Welcome to the MySQL monitor. Commands end with; or \g. Your MySQL connection id is 10 Server version: 8.0.17 MySQL Community Server - GPL…

סיכום

במדריך זה למדת כיצד להתקין ולאבטח שרת MySQL בשרת Debian 10. הראינו לכם כיצד להתחבר למעטפת MySQL.

אם לאפליקציה שלך אין דרישות ספציפיות, עליך להתייצב עם MariaDB, מערכת בסיס הנתונים המוגדרת כברירת מחדל ב- Debian 10.

mysql debian