النص الأصلي الأساسي باللغة الإنجليزي تم ذكره بعد هذا الوصف باللغة العربية

يمكنك استخدام برنامج الخادم مثل XAMPP. تأكد من تثبيته وتشغيله.

إدارة قواعد البيانات عبر لوحة التحكم الرسومية (GUI)

تتيح لك لوحة التحكم الرسومية التحكم الكامل في قواعد البيانات من خلال واجهة المستخدم. للوصول إليها، قم بزيارة الرابط:

http://localhost/phpmyadmin 

يمكنك تنفيذ جميع العمليات التي سنناقشها إما باستخدام PHPMyAdmin أو من خلال سطر الأوامر.

الوصول إلى MySQL من خلال سطر الأوامر (Command Line)

تشغيل الاستعلامات SQL على أنظمة Windows، Mac، وLinux

على نظام Windows

  1. التوجه إلى مجلد XAMPP:
    • عادةً ما يتم تثبيت XAMPP في المسار التالي: C:\xampp. إذا اخترت دليلًا مختلفًا أثناء التثبيت، انتقل إليه.
  2. فتح موجه الأوامر (Command Prompt):
    • اضغط على Win + R، اكتب cmd، واضغط Enter.
    • استخدم الأمر cd للتوجه إلى مجلد bin:
      cd C:\xampp\mysql\bin
  3. تشغيل أمر MySQL:
    • استخدم الأمر التالي مع إدخال البيانات اللازمة:
      mysql --user=root --password=your_password
      • استبدل your_password بكلمة مرور المستخدم root. إذا لم تكن هناك كلمة مرور، يمكنك حذف خيار --password.

على نظام Mac

  1. تحديد موقع تثبيت XAMPP:
    • عادةً ما يتم تثبيت XAMPP في المسار: /Applications/XAMPP.
  2. فتح تطبيق Terminal:
    • استخدم Spotlight (Cmd + Space)، اكتب “Terminal” واضغط Enter.
  3. التوجه إلى مجلد bin:
    cd /Applications/XAMPP/xamppfiles/bin
  4. تشغيل أمر MySQL:
    • استخدم الأمر التالي:
      ./mysql --user=root --password=your_password
      • استبدل your_password بكلمة المرور الفعلية أو احذف خيار --password إذا لم تكن هناك كلمة مرور.

على نظام Linux

  1. التبديل إلى لغة لوحة المفاتيح الإنجليزية:
    • اضغط معًا على الأزرار (CTRL+Alt والحرف R).
  2. تشغيل الأوامر في الطرفية:
    • نفذ كل سطر على حدة:
      sudo systemctl stop mysql
      sudo /opt/lampp/lampp restart
      sudo /opt/lampp/bin/mysql --user=root --password=

ملاحظات عامة:

  • يمكن استخدام PHPMyAdmin لتنفيذ الاستعلامات بسهولة عبر واجهة رسومية، ولكن إذا كنت تُفضّل العمل من خلال سطر الأوامر، فإن الخطوات السابقة تغطي جميع الأنظمة الشائعة.
  • تأكد من استخدام بيانات تسجيل الدخول الصحيحة عند الاتصال بقاعدة البيانات.
  • إذا كنت تعمل على بيئة محلية باستخدام XAMPP، فإن اسم المستخدم الافتراضي هو root وكلمة المرور تكون فارغة افتراضيًا (ما لم تقم بتغييرها).

الخاتمة:

يساعدك الوصول إلى قواعد البيانات باستخدام الطرق المذكورة أعلاه على إدارة البيانات بكفاءة سواء كنت مبتدئًا أو محترفًا. تأكد من التدرب على استخدام كل من واجهة المستخدم وسطر الأوامر لاكتساب خبرة شاملة.

Accessing Database

You can use a Server program like XAMPP, make sure to install it and run it

Manage Databases via GUI Dashboard for Full control via User Interface

Access http://localhost/phpmyadmin

You can perform all actions we gonna perform either using PHPMyAdmin or command lines

Or Accessing the MySQL command in CMD

  • Guidelines to run queries on Windows, Mac and Linux

    Running SQL using command lines on Mac or Windows

    On Windows switch the keyboard language to English then check the following guidlines

    On Windows

    1. Navigate to the XAMPP directory: Typically, XAMPP is installed in C:\\xampp. If you chose a different directory during installation, navigate there.
    2. Open the Command Prompt:
      • Press Win + R, type cmd, and press Enter.
      • Use the cd command to change the directory to the bin folder:
        cd C:\\xampp\\mysql\\bin
        
    3. Run the MySQL command: Use the mysql binary with the necessary options, for example:
      mysql --user=root --password=your_password
      

      Replace your_password with the actual root password. If there is no password set, you can omit the --password option.


    On Mac

    1. Locate XAMPP installation: The default installation path for XAMPP on Mac is usually /Applications/XAMPP.
    2. Open Terminal:
      • Use Spotlight (Cmd + Space), type Terminal, and press Enter.
    3. Navigate to the bin folder:
      cd /Applications/XAMPP/xamppfiles/bin
      
    4. Run the MySQL command: Similar to Windows:
      ./mysql --user=root --password=your_password
      

      Use ./mysql to execute the binary file, and replace your_password with the actual password or omit --password if not set.

    Running SQL ON Linux

    Switch the keyboard language to English and Hold two buttons those are the ( CTRL+Alt and the R letter)

    In the terminal run every line by itself

    sudo systemctl stop mysql
    sudo /opt/lampp/lampp restart
    sudo /opt/lampp/bin/mysql --user=root --password=