How to install MySQL on Linux Debian 9?
תוכן עניינים:
- תנאים מוקדמים
- שלב 1: הגדרת מאגר MySQL
- שלב 3: אימות התקנת MySQL
- שלב 4: אבטחת MySQL
- שלב 5: התחבר ל- MySQL משורת הפקודה
- צור בסיס נתונים
- צור טבלאות
- סיכום
עם שחרורו של Debian 9 Stretch MySQL, מערכת ניהול בסיסי הנתונים הקשורה למקור פתוח הפופולרי ביותר בעולם אינה זמינה עוד במאגרי ה- Debian ומריהDB הפכה למערכת בסיסי ברירת המחדל. MariaDB הוא תחליף Drop-in בינארי תואם לאחור של MySQL.
במדריך זה, נראה לך כיצד להתקין ולאבטח את MySQL במחשב Debian 9 ממאגר MySQL Apt. אם לאפליקציה שלך אין דרישות ספציפיות, עליך להתייצב עם MariaDB, מערכת מסד הנתונים המוגדרת כברירת מחדל ב- Debian 9.
תנאים מוקדמים
לפני שתמשיך במדריך זה, וודא שאתה מחובר כמשתמש עם הרשאות סודו.
שלב 1: הגדרת מאגר MySQL
כדי להוסיף את מאגר ה- MySQL APT למערכת שלך עבור לדף ההורדה של מאגר והורד את חבילת המהדורה האחרונה באמצעות הפקודה הבאה של wget:
wget
לאחר סיום ההורדה, התקן את חבילת השחרור עם הפקודה הבאה:
sudo dpkg -i mysql-apt-config_0.8.10-1_all.deb
תוצג בפניך תפריט התצורה בו תוכל לבחור את גרסת MySQL שברצונך להתקין.
שלב 3: אימות התקנת MySQL
לאחר השלמת ההתקנה, שירות MySQL יתחיל אוטומטית.
אנו יכולים לבדוק את מצב שירות MySQL על ידי הקלדה:
sudo systemctl status mysql
● mysql.service - MySQL Community Server Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: Active: active (running) since Thu 2018-08-02 17:22:18 UTC; 18s ago Docs: man:mysqld(8) http://dev.mysql.com/doc/refman/en/using-systemd.html Process: 14797 ExecStartPre=/usr/share/mysql-8.0/mysql-systemd-start pre (co Main PID: 14832 (mysqld) Status: "SERVER_OPERATING" Tasks: 37 (limit: 4915) CGroup: /system.slice/mysql.service └─14832 /usr/sbin/mysqld
שלב 4: אבטחת 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” (כן) לכל השאלות.
שלב 5: התחבר ל- MySQL משורת הפקודה
כדי ליצור אינטראקציה עם MySQL דרך הטרמינל נשתמש בלקוח MySQL המותקן כתלות של חבילת שרת MySQL.
כדי להיכנס לשרת 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.12 MySQL Community Server - GPL Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>
צור בסיס נתונים
ברגע שאתה מחובר למעטפת MySQL, אתה יכול ליצור בסיס נתונים חדש על ידי הקלדת הפקודה הבאה:
CREATE DATABASE new_database;
Query OK, 1 row affected (0.00 sec)
צור טבלאות
כעת, לאחר שיצרנו בסיס נתונים, נוכל ליצור טבלה לאחסון נתונים.
לפני הפעלת הצהרות SQL ליצירת טבלה עלינו להתחבר למסד הנתונים:
use new_database;
בדוגמה זו ניצור טבלה פשוטה בשם
contacts
עם שלושה שדות,
id
,
name
email
:
CREATE TABLE contacts (id INT PRIMARY KEY, name VARCHAR(30), email VARCHAR(30));
Query OK, 1 row affected (0.00 sec)
סיכום
במדריך זה הראינו לכם כיצד להתקין ולאבטח שרת MySQL בשרת Debian 9. הראינו לכם כיצד להתחבר למעטפת MySQL ואיך ליצור בסיס נתונים וטבלה חדשים.
כעת, כששרת MySQL שלך פועל ואתם יודעים להתחבר לשרת MySQL משורת הפקודה, מומלץ לבדוק את המדריכים הבאים:
mysql debianכיצד להתקין, להתקין hp officejet 6500a בתוספת מדפסת All-in-One

למד כיצד להתקין ולהתקין מדפסת All-in-One של HP Officejet 6500A Plus.
כיצד להתקין ולהשתמש בספסל העבודה של mysql באובונטו 18.04

MySQL Workbench הוא יישום גרפי חוצה פלטפורמות עבור מנהלי ואדריכלים של מסדי נתונים של MySQL. במדריך זה נראה לך כיצד להתקין ו- MySQL Workbench ב- Ubuntu 18.04.
כיצד להתקין את mysql ב- centos 8

הגרסה האחרונה של שרת מסד הנתונים MySQL, גרסה 8.0, זמינה להתקנה ממאגרי ברירת המחדל של CentOS 8. MySQL היא מערכת הפיתוח הפופולרית ביותר בנושא ניהול בסיסי נתונים של קוד פתוח.