Đường dẫn mysql mac

Trong bài viết này mình sẽ hướng dẫn các bạn cách cài đặt MySQL Community Server trên macOS các bạn nhé

Cài đặt

Đầu tiên, các bạn cần phải truy cập địa chỉ https. // nhà phát triển. mysql. com/downloads/mysql/ để tải xuống tập tin cài đặt của MySQL dành cho macOS

Đường dẫn mysql mac

Có nhiều lựa chọn khác nhau, nhưng các bạn nên chọn tập tin. dmg to install because it has an interface, will easy more

Sau khi tải về xong, hãy nhấp vào tập tin tải xuống để bắt đầu cài đặt MySQL các bạn nhé

Đường dẫn mysql mac

MySQL hoạt động như một hệ thống client-server qua mạng TCP/IP. Máy chủ chạy trên máy có địa chỉ IP trên số cổng TCP đã chọn. Số cổng TCP mặc định cho MySQL là 3306. Người dùng có thể truy cập máy chủ thông qua chương trình máy khách, kết nối với máy chủ theo địa chỉ IP và số cổng TCP đã cho

MariaDB

Trích từ Wiki. MariaDB là một ngã ba do cộng đồng phát triển, được hỗ trợ thương mại của hệ thống quản lý cơ sở dữ liệu quan hệ MySQL (RDBMS), nhằm duy trì phần mềm nguồn mở và miễn phí theo Giấy phép Công cộng GNU. Quá trình phát triển được dẫn dắt bởi một số nhà phát triển ban đầu của MySQL, người đã rẽ nhánh nó do lo ngại về việc bị Tập đoàn Oracle mua lại vào năm 2009

Cách cài đặt MySQL 8. 0 và Bắt đầu với Lập trình SQL

Tôi muốn bạn cài đặt MySQL trên máy của riêng bạn, vì tôi muốn bạn học cách cài đặt, tùy chỉnh và vận hành hệ thống phần mềm công nghiệp phức tạp. Cài đặt có thể là phần khó nhất trong bài tập này

Bước 0. Tạo một thư mục để lưu giữ tất cả các tác phẩm của bạn

QUAN TRỌNG. Trước khi bắt đầu, hãy kiểm tra xem bạn có vài GB dung lượng trống không

Tạo một thư mục để giữ tất cả các tác phẩm của bạn được gọi là

  • (Dành cho Windows) "_______15_______7"
  • (Đối với macOS/Linux) "_______15_______8" trong đó "
    XXXXXX XX:XX:XX [Note] mysqld: Normal shutdown
    ......
    XXXXXX XX:XX:XX  InnoDB: Starting shutdown...
    XXXXXX XX:XX:XX  InnoDB: Shutdown completed; log sequence number 0 44233
    ......
    XXXXXX XX:XX:XX [Note] mysqld: Shutdown complete
    (You may need to press ENTER to get the command prompt?!)
    9" biểu thị thư mục chính của bạn
// For Windows: Use "C:\myWebProject"
// Launch a "CMD" and issue these commands:
c:
cd \
mkdir myWebProject

// For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
// Launch a "Terminal" and issue these commands:
cd
mkdir myWebProject

Sử dụng giao diện đồ họa của bạn, e. g. , File Explorer (Windows) hoặc Finder (macOS) để xác minh thư mục này. (Tất nhiên bạn có thể sử dụng giao diện đồ họa của mình để tạo thư mục này. )

cho người mới. Điều quan trọng là phải làm theo bước này. Nếu không, bạn sẽ không đồng bộ với bài viết này và sẽ không thể tìm thấy tệp của mình sau này

Bước 1. Tải xuống và cài đặt MySQL

Cho cửa sổ

  1. Tải xuống Máy chủ Cộng đồng MySQL "ZIP ARCHIVE" từ https. // nhà phát triển. mysql. com/tải xuống/mysql/
    1. Trong tab "Bản phát hành có sẵn chung (GA)"
    2. Trong "Máy chủ cộng đồng MySQL 8. 0. {xx}", trong đó {xx} là số cập nhật mới nhất ⇒ Trong "Select Operating System", chọn "Microsoft Windows"
    3. Trong phần "Tải xuống khác", hãy tải xuống "Windows (x86, 64-bit), ZIP ARCHIVE (khoảng 223MB) (
      -- Change the current directory to MySQL's binary directory.
      -- Assume that the MySQL is installed in "c:\myWebProject\mysql".
      c:
      cd \myWebProject\mysql\bin
         
      -- Start a client as superuser "root" (-u), and prompt for password (-p)
      mysql -u root -p
      Enter password:   // Enter the root's password set during installation.
      Welcome to the MySQL monitor.  Commands end with ; or \g.
      Your MySQL connection id is 1
      Server version: 8.0.xx
      Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
      
      mysql>
      -- Client started. The prompt changes to "mysql>".
      -- You can now issue SQL commands such as SELECT, INSERT and DELETE.
      0)"
    4. Trong "Tải xuống cộng đồng MySQL", KHÔNG cần "Đăng nhập" hoặc "Đăng ký" - Chỉ cần nhấp vào "Không, cảm ơn, chỉ cần bắt đầu tải xuống của tôi. "
  2. Giải nén tệp đã tải xuống vào thư mục dự án của bạn "
    -- Change the current directory to MySQL's binary directory.
    -- Assume that the MySQL is installed in "c:\myWebProject\mysql".
    c:
    cd \myWebProject\mysql\bin
       
    -- Start a client as superuser "root" (-u), and prompt for password (-p)
    mysql -u root -p
    Enter password:   // Enter the root's password set during installation.
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 1
    Server version: 8.0.xx
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    mysql>
    -- Client started. The prompt changes to "mysql>".
    -- You can now issue SQL commands such as SELECT, INSERT and DELETE.
    1". MySQL sẽ được giải nén thành "
    -- Change the current directory to MySQL's binary directory.
    -- Assume that the MySQL is installed in "c:\myWebProject\mysql".
    c:
    cd \myWebProject\mysql\bin
       
    -- Start a client as superuser "root" (-u), and prompt for password (-p)
    mysql -u root -p
    Enter password:   // Enter the root's password set during installation.
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 1
    Server version: 8.0.xx
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    mysql>
    -- Client started. The prompt changes to "mysql>".
    -- You can now issue SQL commands such as SELECT, INSERT and DELETE.
    2". (Nhấp chuột phải vào tệp ⇒ Giải nén tất cả ⇒ Chọn thư mục đích là "
    XXXXXX XX:XX:XX [Note] mysqld: Normal shutdown
    ......
    XXXXXX XX:XX:XX  InnoDB: Starting shutdown...
    XXXXXX XX:XX:XX  InnoDB: Shutdown completed; log sequence number 0 44233
    ......
    XXXXXX XX:XX:XX [Note] mysqld: Shutdown complete
    (You may need to press ENTER to get the command prompt?!)
    7". )
    Để DỄ DÀNG SỬ DỤNG, chúng tôi sẽ RÚT GỌN và ĐỔI TÊN thư mục thành "
    -- Change the current directory to MySQL's binary directory.
    -- Assume that the MySQL is installed in "c:\myWebProject\mysql".
    c:
    cd \myWebProject\mysql\bin
       
    -- Start a client as superuser "root" (-u), and prompt for password (-p)
    mysql -u root -p
    Enter password:   // Enter the root's password set during installation.
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 1
    Server version: 8.0.xx
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    mysql>
    -- Client started. The prompt changes to "mysql>".
    -- You can now issue SQL commands such as SELECT, INSERT and DELETE.
    4". Hãy lưu ý và ghi nhớ thư mục cài đặt MySQL của bạn
  3. (MỚI kể từ MySQL 5. 7. 7) KHỞI TẠO cơ sở dữ liệu. Khởi động CMD với tư cách Quản trị viên (Nhấp vào nút "Tìm kiếm" ⇒ Nhập "cmd" ⇒ chọn "Chạy với tư cách Quản trị viên"
    Ban hành các lệnh này.
    // Change directory to the MySQL's binary directory
    // Suppose that your MySQL is installed in "c:\myWebProject\mysql"
    c:
    cd \myWebProject\mysql\bin
     
    // Initialize the database. Create a root user with random password. Show the messages on console
    mysqld --initialize --console
    ......
    ..... [Note] A temporary password is generated for root@localhost: xxxxxxxx
    Trong quá trình cài đặt, một siêu người dùng có tên là
    -- Change the current directory to MySQL's binary directory.
    -- Assume that the MySQL is installed in "c:\myWebProject\mysql".
    c:
    cd \myWebProject\mysql\bin
       
    -- Start a client as superuser "root" (-u), and prompt for password (-p)
    mysql -u root -p
    Enter password:   // Enter the root's password set during installation.
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 1
    Server version: 8.0.xx
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    mysql>
    -- Client started. The prompt changes to "mysql>".
    -- You can now issue SQL commands such as SELECT, INSERT and DELETE.
    5 được tạo bằng một mật khẩu tạm thời, như minh họa ở trên. HÃY LƯU Ý MẬT KHẨU, SAO CHÉP và LƯU nó ở đâu đó;
    GHI CHÚ. Nếu lỗi "VCRUNTIME140_1. dll không tìm thấy" xảy ra, hãy kiểm tra
  4. Nếu bạn nhập sai hoặc quên mật khẩu, hãy XÓA toàn bộ thư mục đã cài đặt MySQL "
    -- Change the current directory to MySQL's binary directory.
    -- Assume that the MySQL is installed in "c:\myWebProject\mysql".
    c:
    cd \myWebProject\mysql\bin
       
    -- Start a client as superuser "root" (-u), and prompt for password (-p)
    mysql -u root -p
    Enter password:   // Enter the root's password set during installation.
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 1
    Server version: 8.0.xx
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    mysql>
    -- Client started. The prompt changes to "mysql>".
    -- You can now issue SQL commands such as SELECT, INSERT and DELETE.
    6" và LẶP LẠI bước 2 và 3

Đối với macOS

ghi chú. Phiên bản mới nhất của MySQL (8. 0. 32) hoạt động với macOS Monterey (12) và Ventura (13). Nếu bạn đang chạy phiên bản macOS cũ hơn, bạn có thể cần tìm phiên bản lưu trữ của MySQL @ https. // nhà phát triển. mysql. com/downloads/ ⇒ Lưu trữ

  1. Tải xuống Máy chủ cộng đồng MySQL "Lưu trữ DMG" từ https. // nhà phát triển. mysql. com/tải xuống/mysql/
    1. Trong tab "Bản phát hành có sẵn chung (GA)"
    2. Trong "Máy chủ cộng đồng MySQL 8. 0. {xx}", trong đó {xx} là số cập nhật mới nhất ⇒ Trong "Select Operating System", chọn "macOS"
    3. Nếu máy Mac của bạn đang chạy trên bộ xử lý ARM (Apple M1/M2), hãy chọn "Lưu trữ DMG macOS13 (ARM, 64-bit)" (
      -- Change the current directory to MySQL's binary directory.
      -- Assume that the MySQL is installed in "c:\myWebProject\mysql".
      c:
      cd \myWebProject\mysql\bin
         
      -- Start a client as superuser "root" (-u), and prompt for password (-p)
      mysql -u root -p
      Enter password:   // Enter the root's password set during installation.
      Welcome to the MySQL monitor.  Commands end with ; or \g.
      Your MySQL connection id is 1
      Server version: 8.0.xx
      Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
      
      mysql>
      -- Client started. The prompt changes to "mysql>".
      -- You can now issue SQL commands such as SELECT, INSERT and DELETE.
      7)
      Nếu máy mac của bạn đang chạy trên bộ xử lý Intel, hãy chọn "macOS 13 (x86, 64-bit) DMG Archive" cho macOS 12 hoặc 13 (
      -- Change the current directory to MySQL's binary directory.
      -- Assume that the MySQL is installed in "c:\myWebProject\mysql".
      c:
      cd \myWebProject\mysql\bin
         
      -- Start a client as superuser "root" (-u), and prompt for password (-p)
      mysql -u root -p
      Enter password:   // Enter the root's password set during installation.
      Welcome to the MySQL monitor.  Commands end with ; or \g.
      Your MySQL connection id is 1
      Server version: 8.0.xx
      Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
      
      mysql>
      -- Client started. The prompt changes to "mysql>".
      -- You can now issue SQL commands such as SELECT, INSERT and DELETE.
      8)
      • Để kiểm tra phiên bản hệ điều hành của bạn ⇒ Nhấp vào biểu tượng 'Apple' ⇒ "Giới thiệu về máy Mac này"
      • Để kiểm tra bộ xử lý của bạn ⇒ Nhấp vào biểu tượng 'Apple' ⇒ tìm "Intel" (x86);
      • Để kiểm tra xem macOS của bạn là 32-bit hay 64-bit ⇒ Đọc http. //ủng hộ. táo. com/kb/ht3696. Trừ khi bạn có một cỗ máy thời khủng long, nếu không thì nó phải là 64-bit
    4. KHÔNG cần phải "Đăng nhập" hoặc "Đăng ký" - Chỉ cần nhấp vào "Không, cảm ơn, chỉ cần bắt đầu tải xuống của tôi"
  2. Để cài đặt MySQL (Xem https. // nhà phát triển. mysql. com/doc/refman/8. 0/vi/cài đặt macos. html cho ảnh chụp màn hình)
    1. Chuyển đến "Tải xuống" ⇒ Nhấp đúp vào tệp "_______26_______9" đã tải xuống
    2. Bấm đúp vào "
      -- Change the current directory to MySQL's binary directory.
      cd /usr/local/mysql/bin
       
      -- Start a client with superuser "root" (-u), and prompt for password (-p)
      ./mysql -u root -p
      Enter password:   // Enter the root's password given during installation. You will NOT any * for maximum security
      Welcome to the MySQL monitor.  Commands end with ; or \g.
      ......
      mysql>
      -- Client started. The prompt changes to "mysql>".
      -- You can now issue SQL commands such as SELECT, INSERT and DELETE.
      0"
    3. Trong "Giới thiệu", nhấp vào "Tiếp tục"
    4. Trong "Giấy phép", chọn "Đồng ý"
    5. Trong "Kiểu cài đặt", nhấp vào "Cài đặt"
    6. Trong "Cấu hình", chọn "Sử dụng mã hóa mật khẩu mạnh" và nhập mật khẩu cho người dùng "root". Đảm bảo bạn nhớ mật khẩu của mình
    7. MySQL sẽ được cài đặt trong "
      -- Change the current directory to MySQL's binary directory.
      cd /usr/local/mysql/bin
       
      -- Start a client with superuser "root" (-u), and prompt for password (-p)
      ./mysql -u root -p
      Enter password:   // Enter the root's password given during installation. You will NOT any * for maximum security
      Welcome to the MySQL monitor.  Commands end with ; or \g.
      ......
      mysql>
      -- Client started. The prompt changes to "mysql>".
      -- You can now issue SQL commands such as SELECT, INSERT and DELETE.
      1
      -- Change the current directory to MySQL's binary directory.
      cd /usr/local/mysql/bin
       
      -- Start a client with superuser "root" (-u), and prompt for password (-p)
      ./mysql -u root -p
      Enter password:   // Enter the root's password given during installation. You will NOT any * for maximum security
      Welcome to the MySQL monitor.  Commands end with ; or \g.
      ......
      mysql>
      -- Client started. The prompt changes to "mysql>".
      -- You can now issue SQL commands such as SELECT, INSERT and DELETE.
      2". Lưu ý thư mục đã cài đặt này
    8. Đẩy ra ". Tệp
      -- Change the current directory to MySQL's binary directory.
      cd /usr/local/mysql/bin
       
      -- Start a client with superuser "root" (-u), and prompt for password (-p)
      ./mysql -u root -p
      Enter password:   // Enter the root's password given during installation. You will NOT any * for maximum security
      Welcome to the MySQL monitor.  Commands end with ; or \g.
      ......
      mysql>
      -- Client started. The prompt changes to "mysql>".
      -- You can now issue SQL commands such as SELECT, INSERT and DELETE.
      3"
  3. Nếu bạn nhập sai hoặc quên mật khẩu, hãy dừng máy chủ (Nhấp vào Biểu tượng "Apple" ⇒ Tùy chọn hệ thống ⇒ MySQL ⇒ Dừng)
    Đi tới
    -- Change the current directory to MySQL's binary directory.
    cd /usr/local/mysql/bin
     
    -- Start a client with superuser "root" (-u), and prompt for password (-p)
    ./mysql -u root -p
    Enter password:   // Enter the root's password given during installation. You will NOT any * for maximum security
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    ......
    mysql>
    -- Client started. The prompt changes to "mysql>".
    -- You can now issue SQL commands such as SELECT, INSERT and DELETE.
    4 (thông qua Finder ⇒ Go ⇒ GoTo Folder ⇒ gõ
    -- Change the current directory to MySQL's binary directory.
    cd /usr/local/mysql/bin
     
    -- Start a client with superuser "root" (-u), and prompt for password (-p)
    ./mysql -u root -p
    Enter password:   // Enter the root's password given during installation. You will NOT any * for maximum security
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    ......
    mysql>
    -- Client started. The prompt changes to "mysql>".
    -- You can now issue SQL commands such as SELECT, INSERT and DELETE.
    4) và xóa tất cả các thư mục bắt đầu bằng "
    -- Change the current directory to MySQL's binary directory.
    cd /usr/local/mysql/bin
     
    -- Start a client with superuser "root" (-u), and prompt for password (-p)
    ./mysql -u root -p
    Enter password:   // Enter the root's password given during installation. You will NOT any * for maximum security
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    ......
    mysql>
    -- Client started. The prompt changes to "mysql>".
    -- You can now issue SQL commands such as SELECT, INSERT and DELETE.
    6", e. g. , "
    -- Change the current directory to MySQL's binary directory.
    cd /usr/local/mysql/bin
     
    -- Start a client with superuser "root" (-u), and prompt for password (-p)
    ./mysql -u root -p
    Enter password:   // Enter the root's password given during installation. You will NOT any * for maximum security
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    ......
    mysql>
    -- Client started. The prompt changes to "mysql>".
    -- You can now issue SQL commands such as SELECT, INSERT and DELETE.
    7" và "
    -- Change the current directory to MySQL's binary directory.
    cd /usr/local/mysql/bin
     
    -- Start a client with superuser "root" (-u), and prompt for password (-p)
    ./mysql -u root -p
    Enter password:   // Enter the root's password given during installation. You will NOT any * for maximum security
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    ......
    mysql>
    -- Client started. The prompt changes to "mysql>".
    -- You can now issue SQL commands such as SELECT, INSERT and DELETE.
    2" và Chạy lại Bước 2

Tôi sẽ giả sử rằng MySQL được cài đặt trong thư mục

-- Change the current directory to MySQL's binary directory.
cd /usr/local/mysql/bin
 
-- Start a client with superuser "root" (-u), and prompt for password (-p)
./mysql -u root -p
Enter password:   // Enter the root's password given during installation. You will NOT any * for maximum security
Welcome to the MySQL monitor.  Commands end with ; or \g.
......
mysql>
-- Client started. The prompt changes to "mysql>".
-- You can now issue SQL commands such as SELECT, INSERT and DELETE.
9" (đối với Windows) hoặc "
-- Change password for 'root'@'localhost'. Replace xxxx with your chosen password
-- (For macOS, there is no need to change the password, but there is no harm trying it out)
-- (For my students: use xxxx as the password. Otherwise, you will ask me what is your password next week.)
-- Take note that strings are to be enclosed by a pair of single-quotes in MySQL.
mysql> alter user 'root'@'localhost' identified by 'xxxx';
Query OK, 0 rows affected (0.00 sec)

-- Query the password
mysql> select Host, User, authentication_string from mysql.user;
+-----------+------------------+---------------------------+
| Host      | User             | authentication_string     |
+-----------+------------------+---------------------------+
| localhost | root             | $A$005...                |
| ...      | ...             | .......                  |
+-----------+------------------+---------------------------+
   -- Take note that the "HASH" of the password is saved, NOT the "PLAIN" password
   -- [Starting from MySQL 5.x, the "Password" field was removed?!]

-- logout and terminate the client program
mysql> quit
Bye
0" (đối với macOS). Nhưng bạn cần LƯU Ý THƯ MỤC CÀI ĐẶT MySQL CỦA BẠN. Sau đây, tôi sẽ biểu thị thư mục cài đặt MySQL là
-- Change password for 'root'@'localhost'. Replace xxxx with your chosen password
-- (For macOS, there is no need to change the password, but there is no harm trying it out)
-- (For my students: use xxxx as the password. Otherwise, you will ask me what is your password next week.)
-- Take note that strings are to be enclosed by a pair of single-quotes in MySQL.
mysql> alter user 'root'@'localhost' identified by 'xxxx';
Query OK, 0 rows affected (0.00 sec)

-- Query the password
mysql> select Host, User, authentication_string from mysql.user;
+-----------+------------------+---------------------------+
| Host      | User             | authentication_string     |
+-----------+------------------+---------------------------+
| localhost | root             | $A$005...                |
| ...      | ...             | .......                  |
+-----------+------------------+---------------------------+
   -- Take note that the "HASH" of the password is saved, NOT the "PLAIN" password
   -- [Starting from MySQL 5.x, the "Password" field was removed?!]

-- logout and terminate the client program
mysql> quit
Bye
1 trong bài viết này

Bước 3. Bắt đầu "Máy chủ"

MySQL là một hệ thống client-server. Cơ sở dữ liệu được chạy như một ứng dụng máy chủ. Người dùng truy cập máy chủ cơ sở dữ liệu thông qua chương trình máy khách, cục bộ hoặc từ xa qua mạng, như minh họa

Đường dẫn mysql mac
  1. Chương trình máy chủ có tên là "
    -- Change password for 'root'@'localhost'. Replace xxxx with your chosen password
    -- (For macOS, there is no need to change the password, but there is no harm trying it out)
    -- (For my students: use xxxx as the password. Otherwise, you will ask me what is your password next week.)
    -- Take note that strings are to be enclosed by a pair of single-quotes in MySQL.
    mysql> alter user 'root'@'localhost' identified by 'xxxx';
    Query OK, 0 rows affected (0.00 sec)
    
    -- Query the password
    mysql> select Host, User, authentication_string from mysql.user;
    +-----------+------------------+---------------------------+
    | Host      | User             | authentication_string     |
    +-----------+------------------+---------------------------+
    | localhost | root             | $A$005...                |
    | ...      | ...             | .......                  |
    +-----------+------------------+---------------------------+
       -- Take note that the "HASH" of the password is saved, NOT the "PLAIN" password
       -- [Starting from MySQL 5.x, the "Password" field was removed?!]
    
    -- logout and terminate the client program
    mysql> quit
    Bye
    2" (với hậu tố
    -- Change password for 'root'@'localhost'. Replace xxxx with your chosen password
    -- (For macOS, there is no need to change the password, but there is no harm trying it out)
    -- (For my students: use xxxx as the password. Otherwise, you will ask me what is your password next week.)
    -- Take note that strings are to be enclosed by a pair of single-quotes in MySQL.
    mysql> alter user 'root'@'localhost' identified by 'xxxx';
    Query OK, 0 rows affected (0.00 sec)
    
    -- Query the password
    mysql> select Host, User, authentication_string from mysql.user;
    +-----------+------------------+---------------------------+
    | Host      | User             | authentication_string     |
    +-----------+------------------+---------------------------+
    | localhost | root             | $A$005...                |
    | ...      | ...             | .......                  |
    +-----------+------------------+---------------------------+
       -- Take note that the "HASH" of the password is saved, NOT the "PLAIN" password
       -- [Starting from MySQL 5.x, the "Password" field was removed?!]
    
    -- logout and terminate the client program
    mysql> quit
    Bye
    3, viết tắt của daemon - daemon là một tiến trình không tương tác chạy ngầm)
  2. Chương trình khách hàng được gọi là "
    -- Change the current directory to MySQL's binary directory.
    cd /usr/local/mysql/bin
     
    -- Start a client with superuser "root" (-u), and prompt for password (-p)
    ./mysql -u root -p
    Enter password:   // Enter the root's password given during installation. You will NOT any * for maximum security
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    ......
    mysql>
    -- Client started. The prompt changes to "mysql>".
    -- You can now issue SQL commands such as SELECT, INSERT and DELETE.
    2" (không có
    -- Change password for 'root'@'localhost'. Replace xxxx with your chosen password
    -- (For macOS, there is no need to change the password, but there is no harm trying it out)
    -- (For my students: use xxxx as the password. Otherwise, you will ask me what is your password next week.)
    -- Take note that strings are to be enclosed by a pair of single-quotes in MySQL.
    mysql> alter user 'root'@'localhost' identified by 'xxxx';
    Query OK, 0 rows affected (0.00 sec)
    
    -- Query the password
    mysql> select Host, User, authentication_string from mysql.user;
    +-----------+------------------+---------------------------+
    | Host      | User             | authentication_string     |
    +-----------+------------------+---------------------------+
    | localhost | root             | $A$005...                |
    | ...      | ...             | .......                  |
    +-----------+------------------+---------------------------+
       -- Take note that the "HASH" of the password is saved, NOT the "PLAIN" password
       -- [Starting from MySQL 5.x, the "Password" field was removed?!]
    
    -- logout and terminate the client program
    mysql> quit
    Bye
    3)

Các chương trình

-- Change password for 'root'@'localhost'. Replace xxxx with your chosen password
-- (For macOS, there is no need to change the password, but there is no harm trying it out)
-- (For my students: use xxxx as the password. Otherwise, you will ask me what is your password next week.)
-- Take note that strings are to be enclosed by a pair of single-quotes in MySQL.
mysql> alter user 'root'@'localhost' identified by 'xxxx';
Query OK, 0 rows affected (0.00 sec)

-- Query the password
mysql> select Host, User, authentication_string from mysql.user;
+-----------+------------------+---------------------------+
| Host      | User             | authentication_string     |
+-----------+------------------+---------------------------+
| localhost | root             | $A$005...                |
| ...      | ...             | .......                  |
+-----------+------------------+---------------------------+
   -- Take note that the "HASH" of the password is saved, NOT the "PLAIN" password
   -- [Starting from MySQL 5.x, the "Password" field was removed?!]

-- logout and terminate the client program
mysql> quit
Bye
2 và
-- Change the current directory to MySQL's binary directory.
cd /usr/local/mysql/bin
 
-- Start a client with superuser "root" (-u), and prompt for password (-p)
./mysql -u root -p
Enter password:   // Enter the root's password given during installation. You will NOT any * for maximum security
Welcome to the MySQL monitor.  Commands end with ; or \g.
......
mysql>
-- Client started. The prompt changes to "mysql>".
-- You can now issue SQL commands such as SELECT, INSERT and DELETE.
2 được giữ trong thư mục con "
-- Change password for 'root'@'localhost'. Replace xxxx with your chosen password
-- (For macOS, there is no need to change the password, but there is no harm trying it out)
-- (For my students: use xxxx as the password. Otherwise, you will ask me what is your password next week.)
-- Take note that strings are to be enclosed by a pair of single-quotes in MySQL.
mysql> alter user 'root'@'localhost' identified by 'xxxx';
Query OK, 0 rows affected (0.00 sec)

-- Query the password
mysql> select Host, User, authentication_string from mysql.user;
+-----------+------------------+---------------------------+
| Host      | User             | authentication_string     |
+-----------+------------------+---------------------------+
| localhost | root             | $A$005...                |
| ...      | ...             | .......                  |
+-----------+------------------+---------------------------+
   -- Take note that the "HASH" of the password is saved, NOT the "PLAIN" password
   -- [Starting from MySQL 5.x, the "Password" field was removed?!]

-- logout and terminate the client program
mysql> quit
Bye
8" của thư mục cài đặt MySQL

Máy chủ khởi động

Cho cửa sổ

Để khởi động máy chủ cơ sở dữ liệu, hãy khởi chạy trình bao CMD mới

-- Change the current directory to MySQL's binary directory
-- Assume that the MySQL installed directory is "c:\myWebProject\mysql"
c:
cd \myWebProject\mysql\bin
 
-- Start the MySQL Database Server
mysqld --console
// If Windows Defender Firewall popup, choose "allow access".
......
......
XXXXXX XX:XX:XX [Note] mysqld: ready for connections.
Version: '8.0.xx'  socket: ''  port: 3306  MySQL Community Server (GPL)

Ghi chú. Tùy chọn

-- Change password for 'root'@'localhost'. Replace xxxx with your chosen password
-- (For macOS, there is no need to change the password, but there is no harm trying it out)
-- (For my students: use xxxx as the password. Otherwise, you will ask me what is your password next week.)
-- Take note that strings are to be enclosed by a pair of single-quotes in MySQL.
mysql> alter user 'root'@'localhost' identified by 'xxxx';
Query OK, 0 rows affected (0.00 sec)

-- Query the password
mysql> select Host, User, authentication_string from mysql.user;
+-----------+------------------+---------------------------+
| Host      | User             | authentication_string     |
+-----------+------------------+---------------------------+
| localhost | root             | $A$005...                |
| ...      | ...             | .......                  |
+-----------+------------------+---------------------------+
   -- Take note that the "HASH" of the password is saved, NOT the "PLAIN" password
   -- [Starting from MySQL 5.x, the "Password" field was removed?!]

-- logout and terminate the client program
mysql> quit
Bye
9 hướng các thông báo đầu ra tới bảng điều khiển. Nếu không có tùy chọn này, bạn sẽ thấy một màn hình trống

Đối với macOS

CÁCH DỄ DÀNG. Thông qua điều khiển đồ họa. Nhấp vào Biểu tượng "Apple" ⇒ Tùy chọn hệ thống ⇒ MySQL ⇒ Bắt đầu hoặc Dừng

Máy chủ cơ sở dữ liệu MySQL hiện đã bắt đầu và sẵn sàng xử lý các yêu cầu của khách hàng

Bất cứ điều gì có thể đi sai, làm. Đọc ""

Tắt máy chủ

Cho cửa sổ

Cách nhanh nhất để tắt máy chủ cơ sở dữ liệu là nhấn Ctrl-C để bắt đầu tắt máy bình thường. KHÔNG GIẾT máy chủ thông qua nút ĐÓNG của cửa sổ

Quan sát các thông báo này từ bảng điều khiển máy chủ MySQL

XXXXXX XX:XX:XX [Note] mysqld: Normal shutdown
......
XXXXXX XX:XX:XX  InnoDB: Starting shutdown...
XXXXXX XX:XX:XX  InnoDB: Shutdown completed; log sequence number 0 44233
......
XXXXXX XX:XX:XX [Note] mysqld: Shutdown complete
(You may need to press ENTER to get the command prompt?!)

Đối với macOS

CÁCH DỄ DÀNG. Thông qua điều khiển đồ họa. Nhấp vào Biểu tượng "Apple" ⇒ Tùy chọn hệ thống ⇒ MySQL ⇒ Dừng

CẢNH BÁO. Bạn nên tắt máy chủ MySQL đúng cách. Nếu không, bạn có thể làm hỏng cơ sở dữ liệu và có thể gặp sự cố khi khởi động lại nó. NHƯNG, nếu bạn gặp sự cố khi tắt máy chủ bình thường, bạn có thể tắt quy trình "

-- Change password for 'root'@'localhost'. Replace xxxx with your chosen password
-- (For macOS, there is no need to change the password, but there is no harm trying it out)
-- (For my students: use xxxx as the password. Otherwise, you will ask me what is your password next week.)
-- Take note that strings are to be enclosed by a pair of single-quotes in MySQL.
mysql> alter user 'root'@'localhost' identified by 'xxxx';
Query OK, 0 rows affected (0.00 sec)

-- Query the password
mysql> select Host, User, authentication_string from mysql.user;
+-----------+------------------+---------------------------+
| Host      | User             | authentication_string     |
+-----------+------------------+---------------------------+
| localhost | root             | $A$005...                |
| ...      | ...             | .......                  |
+-----------+------------------+---------------------------+
   -- Take note that the "HASH" of the password is saved, NOT the "PLAIN" password
   -- [Starting from MySQL 5.x, the "Password" field was removed?!]

-- logout and terminate the client program
mysql> quit
Bye
2" trong Trình quản lý tác vụ (dành cho Windows);

Bước 4. Bắt đầu một "Khách hàng"

Nhớ lại rằng MySQL là một hệ thống máy khách-máy chủ. Khi máy chủ được khởi động, một hoặc nhiều máy khách có thể được kết nối với máy chủ cơ sở dữ liệu. Một máy khách có thể chạy trên cùng một máy (máy khách cục bộ);

Để đăng nhập vào máy chủ MySQL, bạn cần cung cấp tên người dùng và mật khẩu. Trong quá trình cài đặt, MySQL tạo một siêu người dùng có tên "

-- Change the current directory to MySQL's binary directory.
-- Assume that the MySQL is installed in "c:\myWebProject\mysql".
c:
cd \myWebProject\mysql\bin
   
-- Start a client as superuser "root" (-u), and prompt for password (-p)
mysql -u root -p
Enter password:   // Enter the root's password set during installation.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 8.0.xx
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>
-- Client started. The prompt changes to "mysql>".
-- You can now issue SQL commands such as SELECT, INSERT and DELETE.
5" với mật khẩu tạm thời. Tôi hy vọng rằng bạn đã lưu ý mật khẩu này. (Nếu không, hãy cài đặt lại. )

Cài đặt MySQL cung cấp một chương trình máy khách dòng lệnh có tên "

-- Change the current directory to MySQL's binary directory.
cd /usr/local/mysql/bin
 
-- Start a client with superuser "root" (-u), and prompt for password (-p)
./mysql -u root -p
Enter password:   // Enter the root's password given during installation. You will NOT any * for maximum security
Welcome to the MySQL monitor.  Commands end with ; or \g.
......
mysql>
-- Client started. The prompt changes to "mysql>".
-- You can now issue SQL commands such as SELECT, INSERT and DELETE.
2". (Hãy nhớ rằng chương trình máy chủ được gọi là "
-- Change password for 'root'@'localhost'. Replace xxxx with your chosen password
-- (For macOS, there is no need to change the password, but there is no harm trying it out)
-- (For my students: use xxxx as the password. Otherwise, you will ask me what is your password next week.)
-- Take note that strings are to be enclosed by a pair of single-quotes in MySQL.
mysql> alter user 'root'@'localhost' identified by 'xxxx';
Query OK, 0 rows affected (0.00 sec)

-- Query the password
mysql> select Host, User, authentication_string from mysql.user;
+-----------+------------------+---------------------------+
| Host      | User             | authentication_string     |
+-----------+------------------+---------------------------+
| localhost | root             | $A$005...                |
| ...      | ...             | .......                  |
+-----------+------------------+---------------------------+
   -- Take note that the "HASH" of the password is saved, NOT the "PLAIN" password
   -- [Starting from MySQL 5.x, the "Password" field was removed?!]

-- logout and terminate the client program
mysql> quit
Bye
2" với hậu tố
-- Change password for 'root'@'localhost'. Replace xxxx with your chosen password
-- (For macOS, there is no need to change the password, but there is no harm trying it out)
-- (For my students: use xxxx as the password. Otherwise, you will ask me what is your password next week.)
-- Take note that strings are to be enclosed by a pair of single-quotes in MySQL.
mysql> alter user 'root'@'localhost' identified by 'xxxx';
Query OK, 0 rows affected (0.00 sec)

-- Query the password
mysql> select Host, User, authentication_string from mysql.user;
+-----------+------------------+---------------------------+
| Host      | User             | authentication_string     |
+-----------+------------------+---------------------------+
| localhost | root             | $A$005...                |
| ...      | ...             | .......                  |
+-----------+------------------+---------------------------+
   -- Take note that the "HASH" of the password is saved, NOT the "PLAIN" password
   -- [Starting from MySQL 5.x, the "Password" field was removed?!]

-- logout and terminate the client program
mysql> quit
Bye
3; chương trình máy khách không có hậu tố '
-- Change directory to MySQL's binary directory
c:
cd \myWebProject\mysql\bin
-- Start a MySQL client
mysql -u root -p
Enter password:   // Enter the NEW password
Welcome to the MySQL monitor.
.....  
mysql>
-- client started, ready to issue SQL command
5')

Hãy bắt đầu một ứng dụng khách dòng lệnh với siêu người dùng "______26_______5"

Trước tiên, hãy đảm bảo rằng máy chủ đang chạy. Xem bước trước để khởi động lại máy chủ nếu nó đã bị tắt

Cho cửa sổ

Bắt đầu Shell CMD MỚI khác để chạy máy khách (Bạn cần giữ CMD chạy máy chủ)

-- Change the current directory to MySQL's binary directory.
-- Assume that the MySQL is installed in "c:\myWebProject\mysql".
c:
cd \myWebProject\mysql\bin
   
-- Start a client as superuser "root" (-u), and prompt for password (-p)
mysql -u root -p
Enter password:   // Enter the root's password set during installation.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 8.0.xx
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>
-- Client started. The prompt changes to "mysql>".
-- You can now issue SQL commands such as SELECT, INSERT and DELETE.

Đối với macOS

Mở một "Terminal" MỚI và đưa ra các lệnh này để khởi động ứng dụng khách MySQL với siêu người dùng

-- Change the current directory to MySQL's binary directory.
-- Assume that the MySQL is installed in "c:\myWebProject\mysql".
c:
cd \myWebProject\mysql\bin
   
-- Start a client as superuser "root" (-u), and prompt for password (-p)
mysql -u root -p
Enter password:   // Enter the root's password set during installation.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 8.0.xx
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>
-- Client started. The prompt changes to "mysql>".
-- You can now issue SQL commands such as SELECT, INSERT and DELETE.
5

-- Change the current directory to MySQL's binary directory.
cd /usr/local/mysql/bin
 
-- Start a client with superuser "root" (-u), and prompt for password (-p)
./mysql -u root -p
Enter password:   // Enter the root's password given during installation. You will NOT any * for maximum security
Welcome to the MySQL monitor.  Commands end with ; or \g.
......
mysql>
-- Client started. The prompt changes to "mysql>".
-- You can now issue SQL commands such as SELECT, INSERT and DELETE.

(Bỏ qua trừ khi. ) Đọc ""

Bước 5. Thay đổi mật khẩu cho Superuser "root"

Như đã đề cập trước đó, quá trình cài đặt MySQL tạo một siêu người dùng có tên "

-- Change the current directory to MySQL's binary directory.
-- Assume that the MySQL is installed in "c:\myWebProject\mysql".
c:
cd \myWebProject\mysql\bin
   
-- Start a client as superuser "root" (-u), and prompt for password (-p)
mysql -u root -p
Enter password:   // Enter the root's password set during installation.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 8.0.xx
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>
-- Client started. The prompt changes to "mysql>".
-- You can now issue SQL commands such as SELECT, INSERT and DELETE.
5" với một mật khẩu ngẫu nhiên tạm thời. "______26_______5" là người dùng đặc quyền có thể làm bất cứ điều gì, kể cả xóa tất cả cơ sở dữ liệu. Bạn được yêu cầu thay đổi mật khẩu của root ngay sau khi đăng nhập

ghi chú. Nếu bạn gặp khó khăn khi nhập lệnh, hãy nhấn Ctrl-C để hủy bỏ lệnh hiện tại

Thay đổi mật khẩu cho "root"

Hãy tiếp tục với phiên khách hàng của chúng tôi đã bắt đầu trước đó

-- Change password for 'root'@'localhost'. Replace xxxx with your chosen password
-- (For macOS, there is no need to change the password, but there is no harm trying it out)
-- (For my students: use xxxx as the password. Otherwise, you will ask me what is your password next week.)
-- Take note that strings are to be enclosed by a pair of single-quotes in MySQL.
mysql> alter user 'root'@'localhost' identified by 'xxxx';
Query OK, 0 rows affected (0.00 sec)

-- Query the password
mysql> select Host, User, authentication_string from mysql.user;
+-----------+------------------+---------------------------+
| Host      | User             | authentication_string     |
+-----------+------------------+---------------------------+
| localhost | root             | $A$005...                |
| ...      | ...             | .......                  |
+-----------+------------------+---------------------------+
   -- Take note that the "HASH" of the password is saved, NOT the "PLAIN" password
   -- [Starting from MySQL 5.x, the "Password" field was removed?!]

-- logout and terminate the client program
mysql> quit
Bye
Khởi động lại Máy khách với tư cách "root" bằng Mật khẩu mới

Chúng tôi vừa thay đổi mật khẩu cho

-- Change the current directory to MySQL's binary directory.
-- Assume that the MySQL is installed in "c:\myWebProject\mysql".
c:
cd \myWebProject\mysql\bin
   
-- Start a client as superuser "root" (-u), and prompt for password (-p)
mysql -u root -p
Enter password:   // Enter the root's password set during installation.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 8.0.xx
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>
-- Client started. The prompt changes to "mysql>".
-- You can now issue SQL commands such as SELECT, INSERT and DELETE.
5 và thoát khỏi ứng dụng khách. Bắt đầu một ứng dụng khách và đăng nhập lại với tên
-- Change the current directory to MySQL's binary directory.
-- Assume that the MySQL is installed in "c:\myWebProject\mysql".
c:
cd \myWebProject\mysql\bin
   
-- Start a client as superuser "root" (-u), and prompt for password (-p)
mysql -u root -p
Enter password:   // Enter the root's password set during installation.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 8.0.xx
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>
-- Client started. The prompt changes to "mysql>".
-- You can now issue SQL commands such as SELECT, INSERT and DELETE.
5. Nhập mật khẩu khi được nhắc

Cho cửa sổ

-- Change directory to MySQL's binary directory
c:
cd \myWebProject\mysql\bin
-- Start a MySQL client
mysql -u root -p
Enter password:   // Enter the NEW password
Welcome to the MySQL monitor.
.....  
mysql>
-- client started, ready to issue SQL command

Đối với macOS

-- Change directory to MySQL's binary directory
cd /usr/local/mysql/bin
-- Start a MySQL client
./mysql -u root -p
Enter password:  // Enter the NEW password
Welcome to the MySQL monitor.
......
mysql>
-- client started, ready to issue SQL command

Bước 6. Tạo người dùng mới

Siêu người dùng "root" là đặc quyền, dành cho quản trị cơ sở dữ liệu và không dành cho hoạt động. Chúng tôi sẽ tạo một người dùng mới - hãy gọi nó là "

-- Change directory to MySQL's binary directory
cd /usr/local/mysql/bin
-- Start a MySQL client
./mysql -u root -p
Enter password:  // Enter the NEW password
Welcome to the MySQL monitor.
......
mysql>
-- client started, ready to issue SQL command
2" - với đặc quyền thấp hơn. Để tạo người dùng mới, hãy bắt đầu ứng dụng khách với siêu người dùng "
-- Change the current directory to MySQL's binary directory.
-- Assume that the MySQL is installed in "c:\myWebProject\mysql".
c:
cd \myWebProject\mysql\bin
   
-- Start a client as superuser "root" (-u), and prompt for password (-p)
mysql -u root -p
Enter password:   // Enter the root's password set during installation.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 8.0.xx
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>
-- Client started. The prompt changes to "mysql>".
-- You can now issue SQL commands such as SELECT, INSERT and DELETE.
5"

// For Windows: Use "C:\myWebProject"
// Launch a "CMD" and issue these commands:
c:
cd \
mkdir myWebProject

// For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
// Launch a "Terminal" and issue these commands:
cd
mkdir myWebProject
0
Giải trình
  • TẠO NGƯỜI DÙNG 'myuser'@'localhost' ĐƯỢC XÁC ĐỊNH BỞI 'xxxx'
    Chúng tôi sử dụng lệnh "
    -- Change directory to MySQL's binary directory
    cd /usr/local/mysql/bin
    -- Start a MySQL client
    ./mysql -u root -p
    Enter password:  // Enter the NEW password
    Welcome to the MySQL monitor.
    ......
    mysql>
    -- client started, ready to issue SQL command
    4" để tạo một người dùng mới có tên là
    -- Change directory to MySQL's binary directory
    cd /usr/local/mysql/bin
    -- Start a MySQL client
    ./mysql -u root -p
    Enter password:  // Enter the NEW password
    Welcome to the MySQL monitor.
    ......
    mysql>
    -- client started, ready to issue SQL command
    5, người này có thể đăng nhập vào máy chủ cục bộ từ cùng một máy (nhưng không phải từ xa từ một máy khác), với mật khẩu "
    -- Change directory to MySQL's binary directory
    cd /usr/local/mysql/bin
    -- Start a MySQL client
    ./mysql -u root -p
    Enter password:  // Enter the NEW password
    Welcome to the MySQL monitor.
    ......
    mysql>
    -- client started, ready to issue SQL command
    6"
  • CẤP TẤT CẢ TRÊN *. * ĐẾN 'myuser'@'localhost'
    Người dùng mới được tạo KHÔNG có đặc quyền thực hiện bất kỳ thao tác cơ sở dữ liệu nào, kể cả
    -- Change directory to MySQL's binary directory
    cd /usr/local/mysql/bin
    -- Start a MySQL client
    ./mysql -u root -p
    Enter password:  // Enter the NEW password
    Welcome to the MySQL monitor.
    ......
    mysql>
    -- client started, ready to issue SQL command
    7. Chúng tôi sử dụng lệnh "_______75_______8" để cấp "
    -- Change directory to MySQL's binary directory
    cd /usr/local/mysql/bin
    -- Start a MySQL client
    ./mysql -u root -p
    Enter password:  // Enter the NEW password
    Welcome to the MySQL monitor.
    ......
    mysql>
    -- client started, ready to issue SQL command
    9" các đặc quyền (bao gồm
    -- Change directory to MySQL's binary directory
    cd /usr/local/mysql/bin
    -- Start a MySQL client
    ./mysql -u root -p
    Enter password:  // Enter the NEW password
    Welcome to the MySQL monitor.
    ......
    mysql>
    -- client started, ready to issue SQL command
    7,
    // For Windows: Use "C:\myWebProject"
    // Launch a "CMD" and issue these commands:
    c:
    cd \
    mkdir myWebProject
    
    // For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
    // Launch a "Terminal" and issue these commands:
    cd
    mkdir myWebProject
    01,
    // For Windows: Use "C:\myWebProject"
    // Launch a "CMD" and issue these commands:
    c:
    cd \
    mkdir myWebProject
    
    // For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
    // Launch a "Terminal" and issue these commands:
    cd
    mkdir myWebProject
    02, v.v.) cho người dùng mới này trên TẤT CẢ các cơ sở dữ liệu và TẤT CẢ các bảng ("
    // For Windows: Use "C:\myWebProject"
    // Launch a "CMD" and issue these commands:
    c:
    cd \
    mkdir myWebProject
    
    // For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
    // Launch a "Terminal" and issue these commands:
    cd
    mkdir myWebProject
    03"). Trên thực tế, người dùng mới này có cùng đặc quyền như
    -- Change the current directory to MySQL's binary directory.
    -- Assume that the MySQL is installed in "c:\myWebProject\mysql".
    c:
    cd \myWebProject\mysql\bin
       
    -- Start a client as superuser "root" (-u), and prompt for password (-p)
    mysql -u root -p
    Enter password:   // Enter the root's password set during installation.
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 1
    Server version: 8.0.xx
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    mysql>
    -- Client started. The prompt changes to "mysql>".
    -- You can now issue SQL commands such as SELECT, INSERT and DELETE.
    5, ngoại trừ việc nó không thể ra lệnh
    -- Change directory to MySQL's binary directory
    cd /usr/local/mysql/bin
    -- Start a MySQL client
    ./mysql -u root -p
    Enter password:  // Enter the NEW password
    Welcome to the MySQL monitor.
    ......
    mysql>
    -- client started, ready to issue SQL command
    8. Đối với sản xuất, bạn chỉ nên cấp các đặc quyền cần thiết trên các cơ sở dữ liệu đã chọn và các bảng đã chọn, e. g. , "
    // For Windows: Use "C:\myWebProject"
    // Launch a "CMD" and issue these commands:
    c:
    cd \
    mkdir myWebProject
    
    // For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
    // Launch a "Terminal" and issue these commands:
    cd
    mkdir myWebProject
    06,
    // For Windows: Use "C:\myWebProject"
    // Launch a "CMD" and issue these commands:
    c:
    cd \
    mkdir myWebProject
    
    // For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
    // Launch a "Terminal" and issue these commands:
    cd
    mkdir myWebProject
    01,
    // For Windows: Use "C:\myWebProject"
    // Launch a "CMD" and issue these commands:
    c:
    cd \
    mkdir myWebProject
    
    // For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
    // Launch a "Terminal" and issue these commands:
    cd
    mkdir myWebProject
    08" - nó có thể phát hành
    -- Change directory to MySQL's binary directory
    cd /usr/local/mysql/bin
    -- Start a MySQL client
    ./mysql -u root -p
    Enter password:  // Enter the NEW password
    Welcome to the MySQL monitor.
    ......
    mysql>
    -- client started, ready to issue SQL command
    7,
    // For Windows: Use "C:\myWebProject"
    // Launch a "CMD" and issue these commands:
    c:
    cd \
    mkdir myWebProject
    
    // For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
    // Launch a "Terminal" and issue these commands:
    cd
    mkdir myWebProject
    01 và
    // For Windows: Use "C:\myWebProject"
    // Launch a "CMD" and issue these commands:
    c:
    cd \
    mkdir myWebProject
    
    // For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
    // Launch a "Terminal" and issue these commands:
    cd
    mkdir myWebProject
    11 (nhưng không chỉ phát hành
    // For Windows: Use "C:\myWebProject"
    // Launch a "CMD" and issue these commands:
    c:
    cd \
    mkdir myWebProject
    
    // For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
    // Launch a "Terminal" and issue these commands:
    cd
    mkdir myWebProject
    02,
    // For Windows: Use "C:\myWebProject"
    // Launch a "CMD" and issue these commands:
    c:
    cd \
    mkdir myWebProject
    
    // For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
    // Launch a "Terminal" and issue these commands:
    cd
    mkdir myWebProject
    13) trên TẤT CẢ các bảng của cơ sở dữ liệu
    -- Change the current directory to MySQL's binary directory
    -- Assume that the MySQL installed directory is "c:\myWebProject\mysql"
    c:
    cd \myWebProject\mysql\bin
     
    -- Start the MySQL Database Server
    mysqld --console
    // If Windows Defender Firewall popup, choose "allow access".
    ......
    ......
    XXXXXX XX:XX:XX [Note] mysqld: ready for connections.
    Version: '8.0.xx'  socket: ''  port: 3306  MySQL Community Server (GPL)
    2

Bước 7. Tạo Cơ sở dữ liệu mới, Bảng mới trong Cơ sở dữ liệu, Chèn Bản ghi, Truy vấn và Cập nhật

Nhớ lại rằng máy chủ MySQL tổ chức dữ liệu theo cấu trúc phân cấp sau

  1. Một hệ thống chứa nhiều cơ sở dữ liệu
  2. Một cơ sở dữ liệu chứa nhiều bảng
  3. Một bảng chứa các hàng (bản ghi) và cột (trường)

Hãy tạo một cơ sở dữ liệu có tên "

-- Change the current directory to MySQL's binary directory
-- Assume that the MySQL installed directory is "c:\myWebProject\mysql"
c:
cd \myWebProject\mysql\bin
 
-- Start the MySQL Database Server
mysqld --console
// If Windows Defender Firewall popup, choose "allow access".
......
......
XXXXXX XX:XX:XX [Note] mysqld: ready for connections.
Version: '8.0.xx'  socket: ''  port: 3306  MySQL Community Server (GPL)
2" và một bảng có tên "
-- Change the current directory to MySQL's binary directory
-- Assume that the MySQL installed directory is "c:\myWebProject\mysql"
c:
cd \myWebProject\mysql\bin
 
-- Start the MySQL Database Server
mysqld --console
// If Windows Defender Firewall popup, choose "allow access".
......
......
XXXXXX XX:XX:XX [Note] mysqld: ready for connections.
Version: '8.0.xx'  socket: ''  port: 3306  MySQL Community Server (GPL)
3" trong cơ sở dữ liệu. Bảng sẽ có ba cột.
-- Change the current directory to MySQL's binary directory
-- Assume that the MySQL installed directory is "c:\myWebProject\mysql"
c:
cd \myWebProject\mysql\bin
 
-- Start the MySQL Database Server
mysqld --console
// If Windows Defender Firewall popup, choose "allow access".
......
......
XXXXXX XX:XX:XX [Note] mysqld: ready for connections.
Version: '8.0.xx'  socket: ''  port: 3306  MySQL Community Server (GPL)
4 (kiểu
-- Change the current directory to MySQL's binary directory
-- Assume that the MySQL installed directory is "c:\myWebProject\mysql"
c:
cd \myWebProject\mysql\bin
 
-- Start the MySQL Database Server
mysqld --console
// If Windows Defender Firewall popup, choose "allow access".
......
......
XXXXXX XX:XX:XX [Note] mysqld: ready for connections.
Version: '8.0.xx'  socket: ''  port: 3306  MySQL Community Server (GPL)
7 - số nguyên),
-- Change the current directory to MySQL's binary directory
-- Assume that the MySQL installed directory is "c:\myWebProject\mysql"
c:
cd \myWebProject\mysql\bin
 
-- Start the MySQL Database Server
mysqld --console
// If Windows Defender Firewall popup, choose "allow access".
......
......
XXXXXX XX:XX:XX [Note] mysqld: ready for connections.
Version: '8.0.xx'  socket: ''  port: 3306  MySQL Community Server (GPL)
5 (kiểu
-- Change the current directory to MySQL's binary directory
-- Assume that the MySQL installed directory is "c:\myWebProject\mysql"
c:
cd \myWebProject\mysql\bin
 
-- Start the MySQL Database Server
mysqld --console
// If Windows Defender Firewall popup, choose "allow access".
......
......
XXXXXX XX:XX:XX [Note] mysqld: ready for connections.
Version: '8.0.xx'  socket: ''  port: 3306  MySQL Community Server (GPL)
9 - chuỗi có độ dài thay đổi tối đa 50 ký tự),
-- Change the current directory to MySQL's binary directory
-- Assume that the MySQL installed directory is "c:\myWebProject\mysql"
c:
cd \myWebProject\mysql\bin
 
-- Start the MySQL Database Server
mysqld --console
// If Windows Defender Firewall popup, choose "allow access".
......
......
XXXXXX XX:XX:XX [Note] mysqld: ready for connections.
Version: '8.0.xx'  socket: ''  port: 3306  MySQL Community Server (GPL)
6 (kiểu
XXXXXX XX:XX:XX [Note] mysqld: Normal shutdown
......
XXXXXX XX:XX:XX  InnoDB: Starting shutdown...
XXXXXX XX:XX:XX  InnoDB: Shutdown completed; log sequence number 0 44233
......
XXXXXX XX:XX:XX [Note] mysqld: Shutdown complete
(You may need to press ENTER to get the command prompt?!)
1 - số dấu phẩy động)

THẬN TRỌNG. Lập trình viên không sử dụng ký tự trống và ký tự đặc biệt trong NAM (tên cơ sở dữ liệu, tên bảng, tên cột). Nó không được hỗ trợ hoặc sẽ đặt ra cho bạn nhiều thử thách hơn

Mẹo sử dụng phiên của khách hàng (Hãy quay lại phần này nếu bạn gặp khó khăn khi chạy lệnh)

Trước khi chúng tôi tiếp tục, đây là một số mẹo sử dụng ứng dụng khách

  • Bạn cần kết thúc lệnh của mình bằng dấu chấm phẩy (
    // For Windows: Use "C:\myWebProject"
    // Launch a "CMD" and issue these commands:
    c:
    cd \
    mkdir myWebProject
    
    // For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
    // Launch a "Terminal" and issue these commands:
    cd
    mkdir myWebProject
    23), dấu chấm phẩy này sẽ gửi lệnh đến máy chủ để xử lý. e. g. ,
    // For Windows: Use "C:\myWebProject"
    // Launch a "CMD" and issue these commands:
    c:
    cd \
    mkdir myWebProject
    
    // For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
    // Launch a "Terminal" and issue these commands:
    cd
    mkdir myWebProject
    1
  • Một lệnh có thể kéo dài nhiều dòng. Lời nhắc cho các dòng tiếp theo thay đổi thành
    // For Windows: Use "C:\myWebProject"
    // Launch a "CMD" and issue these commands:
    c:
    cd \
    mkdir myWebProject
    
    // For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
    // Launch a "Terminal" and issue these commands:
    cd
    mkdir myWebProject
    24 để biểu thị sự tiếp tục. Bạn cần kết thúc lệnh bằng dấu chấm phẩy (
    // For Windows: Use "C:\myWebProject"
    // Launch a "CMD" and issue these commands:
    c:
    cd \
    mkdir myWebProject
    
    // For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
    // Launch a "Terminal" and issue these commands:
    cd
    mkdir myWebProject
    23). e. g. ,
    // For Windows: Use "C:\myWebProject"
    // Launch a "CMD" and issue these commands:
    c:
    cd \
    mkdir myWebProject
    
    // For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
    // Launch a "Terminal" and issue these commands:
    cd
    mkdir myWebProject
    2Nói cách khác, nếu bạn quên gõ
    // For Windows: Use "C:\myWebProject"
    // Launch a "CMD" and issue these commands:
    c:
    cd \
    mkdir myWebProject
    
    // For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
    // Launch a "Terminal" and issue these commands:
    cd
    mkdir myWebProject
    26, bạn có thể gõ
    // For Windows: Use "C:\myWebProject"
    // Launch a "CMD" and issue these commands:
    c:
    cd \
    mkdir myWebProject
    
    // For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
    // Launch a "Terminal" and issue these commands:
    cd
    mkdir myWebProject
    26 ở dòng tiếp theo
  • Bạn có thể sử dụng
    // For Windows: Use "C:\myWebProject"
    // Launch a "CMD" and issue these commands:
    c:
    cd \
    mkdir myWebProject
    
    // For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
    // Launch a "Terminal" and issue these commands:
    cd
    mkdir myWebProject
    28 để hủy bỏ (abort) lệnh hiện tại. e. g. ,
    // For Windows: Use "C:\myWebProject"
    // Launch a "CMD" and issue these commands:
    c:
    cd \
    mkdir myWebProject
    
    // For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
    // Launch a "Terminal" and issue these commands:
    cd
    mkdir myWebProject
    3
  • Nếu bạn mở một trích dẫn đơn/đôi mà không đóng nó, lời nhắc tiếp tục sẽ thay đổi thành
    // For Windows: Use "C:\myWebProject"
    // Launch a "CMD" and issue these commands:
    c:
    cd \
    mkdir myWebProject
    
    // For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
    // Launch a "Terminal" and issue these commands:
    cd
    mkdir myWebProject
    29 hoặc
    // For Windows: Use "C:\myWebProject"
    // Launch a "CMD" and issue these commands:
    c:
    cd \
    mkdir myWebProject
    
    // For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
    // Launch a "Terminal" and issue these commands:
    cd
    mkdir myWebProject
    30 (thay vì
    // For Windows: Use "C:\myWebProject"
    // Launch a "CMD" and issue these commands:
    c:
    cd \
    mkdir myWebProject
    
    // For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
    // Launch a "Terminal" and issue these commands:
    cd
    mkdir myWebProject
    24). Ví dụ,
    // For Windows: Use "C:\myWebProject"
    // Launch a "CMD" and issue these commands:
    c:
    cd \
    mkdir myWebProject
    
    // For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
    // Launch a "Terminal" and issue these commands:
    cd
    mkdir myWebProject
    4
  • Bạn cũng có thể nhấn Ctrl-C để hủy bỏ lệnh hiện tại
  • Bạn có thể sử dụng các phím mũi tên lên/xuống để truy xuất các lệnh trước đó/tiếp theo, từ "lịch sử lệnh"
  • (Đối với Windows 10) Bạn nên bật chức năng Copy/Paste của CMD shell. Để bật Sao chép/Dán, nhấp vào biểu tượng CMD ⇒ Thuộc tính ⇒ Tùy chọn ⇒ Chỉnh sửa tùy chọn ⇒ Kiểm tra "Bật phím tắt Ctrl". Sau đó, bạn có thể sử dụng Ctrl-C/Ctrl-V để Sao chép/Dán

Hãy bắt đầu một ứng dụng khách với người dùng mới được tạo của chúng tôi "_______75_______2"

// For Windows: Use "C:\myWebProject"
// Launch a "CMD" and issue these commands:
c:
cd \
mkdir myWebProject

// For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
// Launch a "Terminal" and issue these commands:
cd
mkdir myWebProject
5
bài tập
  1. Chọn các bản ghi có tên bắt đầu bằng chữ cái
    // For Windows: Use "C:\myWebProject"
    // Launch a "CMD" and issue these commands:
    c:
    cd \
    mkdir myWebProject
    
    // For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
    // Launch a "Terminal" and issue these commands:
    cd
    mkdir myWebProject
    33. (Gợi ý.
    // For Windows: Use "C:\myWebProject"
    // Launch a "CMD" and issue these commands:
    c:
    cd \
    mkdir myWebProject
    
    // For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
    // Launch a "Terminal" and issue these commands:
    cd
    mkdir myWebProject
    34, xem Phần "")
  2. Chọn các bản ghi có tên KHÔNG bắt đầu bằng chữ cái
    // For Windows: Use "C:\myWebProject"
    // Launch a "CMD" and issue these commands:
    c:
    cd \
    mkdir myWebProject
    
    // For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
    // Launch a "Terminal" and issue these commands:
    cd
    mkdir myWebProject
    33. (Gợi ý.
    // For Windows: Use "C:\myWebProject"
    // Launch a "CMD" and issue these commands:
    c:
    cd \
    mkdir myWebProject
    
    // For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
    // Launch a "Terminal" and issue these commands:
    cd
    mkdir myWebProject
    36)
  3. Chọn các bản ghi có
    -- Change the current directory to MySQL's binary directory
    -- Assume that the MySQL installed directory is "c:\myWebProject\mysql"
    c:
    cd \myWebProject\mysql\bin
     
    -- Start the MySQL Database Server
    mysqld --console
    // If Windows Defender Firewall popup, choose "allow access".
    ......
    ......
    XXXXXX XX:XX:XX [Note] mysqld: ready for connections.
    Version: '8.0.xx'  socket: ''  port: 3306  MySQL Community Server (GPL)
    6 giữa 4. 35 và 4. 65. (Gợi ý.
    // For Windows: Use "C:\myWebProject"
    // Launch a "CMD" and issue these commands:
    c:
    cd \
    mkdir myWebProject
    
    // For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
    // Launch a "Terminal" and issue these commands:
    cd
    mkdir myWebProject
    38)
  4. Chọn các bản ghi có tên có chữ cái
    // For Windows: Use "C:\myWebProject"
    // Launch a "CMD" and issue these commands:
    c:
    cd \
    mkdir myWebProject
    
    // For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
    // Launch a "Terminal" and issue these commands:
    cd
    mkdir myWebProject
    39. (Gợi ý.
    // For Windows: Use "C:\myWebProject"
    // Launch a "CMD" and issue these commands:
    c:
    cd \
    mkdir myWebProject
    
    // For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
    // Launch a "Terminal" and issue these commands:
    cd
    mkdir myWebProject
    40)
  5. Chọn các bản ghi có tên có chữ cái
    // For Windows: Use "C:\myWebProject"
    // Launch a "CMD" and issue these commands:
    c:
    cd \
    mkdir myWebProject
    
    // For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
    // Launch a "Terminal" and issue these commands:
    cd
    mkdir myWebProject
    39 hoặc
    // For Windows: Use "C:\myWebProject"
    // Launch a "CMD" and issue these commands:
    c:
    cd \
    mkdir myWebProject
    
    // For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
    // Launch a "Terminal" and issue these commands:
    cd
    mkdir myWebProject
    42. (Gợi ý.
    // For Windows: Use "C:\myWebProject"
    // Launch a "CMD" and issue these commands:
    c:
    cd \
    mkdir myWebProject
    
    // For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
    // Launch a "Terminal" and issue these commands:
    cd
    mkdir myWebProject
    43)
  6. Chọn các bản ghi có tên có chữ cái
    // For Windows: Use "C:\myWebProject"
    // Launch a "CMD" and issue these commands:
    c:
    cd \
    mkdir myWebProject
    
    // For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
    // Launch a "Terminal" and issue these commands:
    cd
    mkdir myWebProject
    39 và
    // For Windows: Use "C:\myWebProject"
    // Launch a "CMD" and issue these commands:
    c:
    cd \
    mkdir myWebProject
    
    // For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
    // Launch a "Terminal" and issue these commands:
    cd
    mkdir myWebProject
    45

(Bỏ qua trừ khi. ) Đọc ""

Bài tập khác

  1. Hiển thị tất cả các cơ sở dữ liệu
  2. Tạo một cơ sở dữ liệu mới gọi là "______25_______46"
  3. Đặt cơ sở dữ liệu "_______25_______46" làm cơ sở dữ liệu mặc định
  4. Hiển thị tất cả các bảng trong cơ sở dữ liệu mặc định
  5. Tạo một bảng mới có tên "
    // For Windows: Use "C:\myWebProject"
    // Launch a "CMD" and issue these commands:
    c:
    cd \
    mkdir myWebProject
    
    // For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
    // Launch a "Terminal" and issue these commands:
    cd
    mkdir myWebProject
    48" với các cột và loại được chỉ định bên dưới.
    // For Windows: Use "C:\myWebProject"
    // Launch a "CMD" and issue these commands:
    c:
    cd \
    mkdir myWebProject
    
    // For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
    // Launch a "Terminal" and issue these commands:
    cd
    mkdir myWebProject
    6
  6. Hiển thị mô tả bảng
  7. Chèn các bản ghi trên và liệt kê tất cả các bản ghi
  8. Liệt kê các bản ghi có tên chứa "
    // For Windows: Use "C:\myWebProject"
    // Launch a "CMD" and issue these commands:
    c:
    cd \
    mkdir myWebProject
    
    // For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
    // Launch a "Terminal" and issue these commands:
    cd
    mkdir myWebProject
    49"
  9. Liệt kê các bản ghi có giá ≥ 1. 0
  10. Tăng giá của tất cả các mặt hàng lên 10% và liệt kê tất cả các bản ghi
  11. Xóa "Bút đỏ" khỏi bảng và liệt kê tất cả các bản ghi

Mối quan hệ nhiều-nhiều

Trong hiệu sách, một cuốn sách được viết bởi một hoặc nhiều tác giả; . Đây được gọi là mối quan hệ nhiều-nhiều. KHÔNG THỂ nắm bắt được mối quan hệ nhiều-nhiều trong một bảng DUY NHẤT (hoặc một bảng tính) với một số cột cố định mà không sao chép bất kỳ phần thông tin nào. Ví dụ: nếu bạn tổ chức dữ liệu trong bảng dưới đây, bạn sẽ không biết có bao nhiêu cột tác giả sẽ được sử dụng;

Đường dẫn mysql mac

Mối quan hệ nhiều-nhiều giữa sách và tác giả có thể được mô hình hóa bằng 3 bảng, như hình bên dưới. Bảng

// For Windows: Use "C:\myWebProject"
// Launch a "CMD" and issue these commands:
c:
cd \
mkdir myWebProject

// For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
// Launch a "Terminal" and issue these commands:
cd
mkdir myWebProject
50 chứa dữ liệu về sách (chẳng hạn như tên sách và giá); . Một bảng có tên là
// For Windows: Use "C:\myWebProject"
// Launch a "CMD" and issue these commands:
c:
cd \
mkdir myWebProject

// For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
// Launch a "Terminal" and issue these commands:
cd
mkdir myWebProject
52 tham gia các bảng
// For Windows: Use "C:\myWebProject"
// Launch a "CMD" and issue these commands:
c:
cd \
mkdir myWebProject

// For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
// Launch a "Terminal" and issue these commands:
cd
mkdir myWebProject
50 và
// For Windows: Use "C:\myWebProject"
// Launch a "CMD" and issue these commands:
c:
cd \
mkdir myWebProject

// For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
// Launch a "Terminal" and issue these commands:
cd
mkdir myWebProject
51 và nắm bắt mối quan hệ nhiều-nhiều giữa
// For Windows: Use "C:\myWebProject"
// Launch a "CMD" and issue these commands:
c:
cd \
mkdir myWebProject

// For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
// Launch a "Terminal" and issue these commands:
cd
mkdir myWebProject
50 và
// For Windows: Use "C:\myWebProject"
// Launch a "CMD" and issue these commands:
c:
cd \
mkdir myWebProject

// For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
// Launch a "Terminal" and issue these commands:
cd
mkdir myWebProject
51

Đường dẫn mysql mac
bài tập
  1. Tạo cơ sở dữ liệu có tên "
    // For Windows: Use "C:\myWebProject"
    // Launch a "CMD" and issue these commands:
    c:
    cd \
    mkdir myWebProject
    
    // For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
    // Launch a "Terminal" and issue these commands:
    cd
    mkdir myWebProject
    57"
  2. Sử dụng "
    // For Windows: Use "C:\myWebProject"
    // Launch a "CMD" and issue these commands:
    c:
    cd \
    mkdir myWebProject
    
    // For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
    // Launch a "Terminal" and issue these commands:
    cd
    mkdir myWebProject
    57" làm cơ sở dữ liệu mặc định
  3. Tạo 3 bảng "
    // For Windows: Use "C:\myWebProject"
    // Launch a "CMD" and issue these commands:
    c:
    cd \
    mkdir myWebProject
    
    // For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
    // Launch a "Terminal" and issue these commands:
    cd
    mkdir myWebProject
    50", "
    // For Windows: Use "C:\myWebProject"
    // Launch a "CMD" and issue these commands:
    c:
    cd \
    mkdir myWebProject
    
    // For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
    // Launch a "Terminal" and issue these commands:
    cd
    mkdir myWebProject
    51" và "
    // For Windows: Use "C:\myWebProject"
    // Launch a "CMD" and issue these commands:
    c:
    cd \
    mkdir myWebProject
    
    // For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
    // Launch a "Terminal" and issue these commands:
    cd
    mkdir myWebProject
    52" trong cơ sở dữ liệu "
    // For Windows: Use "C:\myWebProject"
    // Launch a "CMD" and issue these commands:
    c:
    cd \
    mkdir myWebProject
    
    // For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
    // Launch a "Terminal" and issue these commands:
    cd
    mkdir myWebProject
    57", với tên và loại cột như trong sơ đồ cơ sở dữ liệu
  4. Chèn các bản ghi tương ứng vào các bảng và liệt kê nội dung của từng bảng
  5. Hãy thử truy vấn này và giải thích đầu ra.
    // For Windows: Use "C:\myWebProject"
    // Launch a "CMD" and issue these commands:
    c:
    cd \
    mkdir myWebProject
    
    // For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
    // Launch a "Terminal" and issue these commands:
    cd
    mkdir myWebProject
    7
  6. Hãy thử truy vấn này và quan sát cách nối các bảng.
    // For Windows: Use "C:\myWebProject"
    // Launch a "CMD" and issue these commands:
    c:
    cd \
    mkdir myWebProject
    
    // For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
    // Launch a "Terminal" and issue these commands:
    cd
    mkdir myWebProject
    8
  7. Liệt kê tất cả các cuốn sách (
    // For Windows: Use "C:\myWebProject"
    // Launch a "CMD" and issue these commands:
    c:
    cd \
    mkdir myWebProject
    
    // For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
    // Launch a "Terminal" and issue these commands:
    cd
    mkdir myWebProject
    63,
    // For Windows: Use "C:\myWebProject"
    // Launch a "CMD" and issue these commands:
    c:
    cd \
    mkdir myWebProject
    
    // For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
    // Launch a "Terminal" and issue these commands:
    cd
    mkdir myWebProject
    64,
    // For Windows: Use "C:\myWebProject"
    // Launch a "CMD" and issue these commands:
    c:
    cd \
    mkdir myWebProject
    
    // For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
    // Launch a "Terminal" and issue these commands:
    cd
    mkdir myWebProject
    65) của "Tan Ah Teck" với
    // For Windows: Use "C:\myWebProject"
    // Launch a "CMD" and issue these commands:
    c:
    cd \
    mkdir myWebProject
    
    // For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
    // Launch a "Terminal" and issue these commands:
    cd
    mkdir myWebProject
    64 nhỏ hơn
    // For Windows: Use "C:\myWebProject"
    // Launch a "CMD" and issue these commands:
    c:
    cd \
    mkdir myWebProject
    
    // For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
    // Launch a "Terminal" and issue these commands:
    cd
    mkdir myWebProject
    67
  8. Liệt kê tất cả các tác giả (
    -- Change the current directory to MySQL's binary directory
    -- Assume that the MySQL installed directory is "c:\myWebProject\mysql"
    c:
    cd \myWebProject\mysql\bin
     
    -- Start the MySQL Database Server
    mysqld --console
    // If Windows Defender Firewall popup, choose "allow access".
    ......
    ......
    XXXXXX XX:XX:XX [Note] mysqld: ready for connections.
    Version: '8.0.xx'  socket: ''  port: 3306  MySQL Community Server (GPL)
    5 và
    // For Windows: Use "C:\myWebProject"
    // Launch a "CMD" and issue these commands:
    c:
    cd \
    mkdir myWebProject
    
    // For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
    // Launch a "Terminal" and issue these commands:
    cd
    mkdir myWebProject
    69) cho tên sách "Java dành cho người mới bắt đầu"
  9. Liệt kê tất cả các cuốn sách (
    // For Windows: Use "C:\myWebProject"
    // Launch a "CMD" and issue these commands:
    c:
    cd \
    mkdir myWebProject
    
    // For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
    // Launch a "Terminal" and issue these commands:
    cd
    mkdir myWebProject
    63,
    // For Windows: Use "C:\myWebProject"
    // Launch a "CMD" and issue these commands:
    c:
    cd \
    mkdir myWebProject
    
    // For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
    // Launch a "Terminal" and issue these commands:
    cd
    mkdir myWebProject
    64,
    // For Windows: Use "C:\myWebProject"
    // Launch a "CMD" and issue these commands:
    c:
    cd \
    mkdir myWebProject
    
    // For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
    // Launch a "Terminal" and issue these commands:
    cd
    mkdir myWebProject
    65) và tất cả các tác giả (
    -- Change the current directory to MySQL's binary directory
    -- Assume that the MySQL installed directory is "c:\myWebProject\mysql"
    c:
    cd \myWebProject\mysql\bin
     
    -- Start the MySQL Database Server
    mysqld --console
    // If Windows Defender Firewall popup, choose "allow access".
    ......
    ......
    XXXXXX XX:XX:XX [Note] mysqld: ready for connections.
    Version: '8.0.xx'  socket: ''  port: 3306  MySQL Community Server (GPL)
    5 và
    // For Windows: Use "C:\myWebProject"
    // Launch a "CMD" and issue these commands:
    c:
    cd \
    mkdir myWebProject
    
    // For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
    // Launch a "Terminal" and issue these commands:
    cd
    mkdir myWebProject
    69) đối với những cuốn sách có tựa đề bắt đầu bằng "Java" (Gợi ý.
    // For Windows: Use "C:\myWebProject"
    // Launch a "CMD" and issue these commands:
    c:
    cd \
    mkdir myWebProject
    
    // For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
    // Launch a "Terminal" and issue these commands:
    cd
    mkdir myWebProject
    75)

(Tùy chọn) Sao lưu và khôi phục cơ sở dữ liệu

Sao lưu thông qua chương trình tiện ích "mysqldump"

Bạn có thể sử dụng chương trình tiện ích

// For Windows: Use "C:\myWebProject"
// Launch a "CMD" and issue these commands:
c:
cd \
mkdir myWebProject

// For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
// Launch a "Terminal" and issue these commands:
cd
mkdir myWebProject
76 để sao lưu (i) toàn bộ máy chủ (tất cả cơ sở dữ liệu), (ii) cơ sở dữ liệu được chọn hoặc (ii) bảng được chọn của cơ sở dữ liệu. Chương trình "_______25_______77" tạo tập lệnh SQL mà sau này có thể được thực thi để tạo lại cơ sở dữ liệu, bảng và các hàng của chúng

Ví dụ: lệnh sau sao lưu toàn bộ cơ sở dữ liệu "_______4_______2" vào tập lệnh SQL có tên "

// For Windows: Use "C:\myWebProject"
// Launch a "CMD" and issue these commands:
c:
cd \
mkdir myWebProject

// For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
// Launch a "Terminal" and issue these commands:
cd
mkdir myWebProject
79"

Cho cửa sổ

// For Windows: Use "C:\myWebProject"
// Launch a "CMD" and issue these commands:
c:
cd \
mkdir myWebProject

// For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
// Launch a "Terminal" and issue these commands:
cd
mkdir myWebProject
9

Đối với macOS

// Change directory to the MySQL's binary directory
// Suppose that your MySQL is installed in "c:\myWebProject\mysql"
c:
cd \myWebProject\mysql\bin
 
// Initialize the database. Create a root user with random password. Show the messages on console
mysqld --initialize --console
......
..... [Note] A temporary password is generated for root@localhost: xxxxxxxx
0

Nghiên cứu tệp đầu ra, chứa các câu lệnh

// For Windows: Use "C:\myWebProject"
// Launch a "CMD" and issue these commands:
c:
cd \
mkdir myWebProject

// For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
// Launch a "Terminal" and issue these commands:
cd
mkdir myWebProject
80,
-- Change the current directory to MySQL's binary directory
-- Assume that the MySQL installed directory is "c:\myWebProject\mysql"
c:
cd \myWebProject\mysql\bin
 
-- Start the MySQL Database Server
mysqld --console
// If Windows Defender Firewall popup, choose "allow access".
......
......
XXXXXX XX:XX:XX [Note] mysqld: ready for connections.
Version: '8.0.xx'  socket: ''  port: 3306  MySQL Community Server (GPL)
0 và
// Change directory to the MySQL's binary directory
// Suppose that your MySQL is installed in "c:\myWebProject\mysql"
c:
cd \myWebProject\mysql\bin
 
// Initialize the database. Create a root user with random password. Show the messages on console
mysqld --initialize --console
......
..... [Note] A temporary password is generated for root@localhost: xxxxxxxx
7 để tạo lại cơ sở dữ liệu và các bảng đã kết xuất trước đó

Khôi phục thông qua lệnh "nguồn" trong máy khách mysql

Bạn có thể khôi phục từ bản sao lưu bằng cách chạy lệnh "

// For Windows: Use "C:\myWebProject"
// Launch a "CMD" and issue these commands:
c:
cd \
mkdir myWebProject

// For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
// Launch a "Terminal" and issue these commands:
cd
mkdir myWebProject
83" trong máy khách MySQL. Ví dụ: để khôi phục bản sao lưu
-- Change the current directory to MySQL's binary directory
-- Assume that the MySQL installed directory is "c:\myWebProject\mysql"
c:
cd \myWebProject\mysql\bin
 
-- Start the MySQL Database Server
mysqld --console
// If Windows Defender Firewall popup, choose "allow access".
......
......
XXXXXX XX:XX:XX [Note] mysqld: ready for connections.
Version: '8.0.xx'  socket: ''  port: 3306  MySQL Community Server (GPL)
2 trước đó

Cho cửa sổ

// Change directory to the MySQL's binary directory
// Suppose that your MySQL is installed in "c:\myWebProject\mysql"
c:
cd \myWebProject\mysql\bin
 
// Initialize the database. Create a root user with random password. Show the messages on console
mysqld --initialize --console
......
..... [Note] A temporary password is generated for root@localhost: xxxxxxxx
1

Đối với macOS

// Change directory to the MySQL's binary directory
// Suppose that your MySQL is installed in "c:\myWebProject\mysql"
c:
cd \myWebProject\mysql\bin
 
// Initialize the database. Create a root user with random password. Show the messages on console
mysqld --initialize --console
......
..... [Note] A temporary password is generated for root@localhost: xxxxxxxx
2

Tóm tắt các lệnh thường dùng

(Dành cho Windows) Khởi động Máy chủ và Máy khách MySQL
(Đối với macOS) Khởi động Máy chủ và Máy khách MySQL
Các lệnh MySQL thường được sử dụng

Các lệnh MySQL KHÔNG phân biệt chữ hoa chữ thường

(Bỏ qua trừ khi. ) Làm thế nào để gỡ lỗi?

"Mọi thứ có thể sai sẽ sai. " Điều quan trọng nhất cần làm là tìm TIN NHẮN LỖI

GÂY RA. Bạn không có "thời gian chạy có thể phân phối lại của Microsoft Visual C++" được yêu cầu

DUNG DỊCH. Xem "Bản tải xuống Visual C++ được hỗ trợ mới nhất" @ https. //ủng hộ. Microsoft. com/en-gb/help/2977003/the-latest-supported-visual-c-downloads ⇒ Tải xuống "x64.

// For Windows: Use "C:\myWebProject"
// Launch a "CMD" and issue these commands:
c:
cd \
mkdir myWebProject

// For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
// Launch a "Terminal" and issue these commands:
cd
mkdir myWebProject
85" ⇒ chạy tệp thực thi để cài đặt "Microsoft Visual C++ 2015-2019 redistributable (x64)" ⇒ Khởi động lại máy tính của bạn ⇒ Bạn có thể tìm thấy "
// For Windows: Use "C:\myWebProject"
// Launch a "CMD" and issue these commands:
c:
cd \
mkdir myWebProject

// For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
// Launch a "Terminal" and issue these commands:
cd
mkdir myWebProject
86" trong "
// For Windows: Use "C:\myWebProject"
// Launch a "CMD" and issue these commands:
c:
cd \
mkdir myWebProject

// For macOS: Use "~/myWebProject" (where "~" denotes your home directory)
// Launch a "Terminal" and issue these commands:
cd
mkdir myWebProject
87"