Trong bài đăng này, chúng ta sẽ xem cách khởi động, dừng và khởi động lại máy chủ MySQL trên MacOS, Linux và Windows. 1. Trên Mac Bạn có thể khởi động/dừng/khởi động lại máy chủ MySQL thông qua dòng lệnh.sudo /usr/local/mysql/support-files/mysql.server start
sudo /usr/local/mysql/support-files/mysql.server stop
sudo /usr/local/mysql/support-files/mysql.server restart
- Đối với phiên bản MySQL 5.7 và mới hơn:
sudo launchctl load -F /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist
sudo launchctl unload -F /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist
- Hoặc bạn có thể bật/tắt thông qua bảng ưu tiên macOS
Có một cách khác mà bạn có thể sử dụng DBNGIN, một tiện ích miễn phí để cài đặt và quản lý nhiều máy chủ cơ sở dữ liệu trên Mac.DBngin, an free utility to install and manage multiple database servers on Mac.
- Để bật/tắt, nó chỉ một cú nhấp chuột từ bảng điều khiển máy chủ:
2. Trên Linux
- Trên Linux Start/Stop từ dòng lệnh:
/etc/init.d/mysqld start
/etc/init.d/mysqld stop
/etc/init.d/mysqld restart
- Một số hương vị Linux cũng cung cấp lệnh dịch vụ
service mysqld start
service mysqld stop
service mysqld restart
- hoặc
service mysql start
service mysql stop
service mysql restart
3. Trên Windows
- Mở & nbsp; Run & nbsp; Window by & nbsp; ________ 12
- Type
3sudo launchctl load -F /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist sudo launchctl unload -F /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist
- Search & nbsp; mysql & nbsp; dịch vụ dựa trên phiên bản được cài đặt.
- Nhấp vào dừng, bắt đầu hoặc khởi động lại tùy chọn dịch vụ.
Hoặc bạn có thể bắt đầu/dừng MySQL khỏi dấu nhắc lệnh:
C:\> "C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld"
C:\> "C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqladmin" -u root shutdown
Cần một công cụ GUI tốt cho MySQL trên macOS và Windows? TablePlus là một công cụ hiện đại, gốc với GUI thanh lịch, cho phép bạn quản lý đồng thời nhiều cơ sở dữ liệu như MySQL, PostgreSQL, SQLite, Microsoft SQL Server, và hơn thế nữa.
Tải xuống TablePlus cho Mac. Dù sao thì nó cũng miễn phí!. It’s free anyway!
Không phải trên Mac? Tải xuống bảng cho Windows. Download TablePlus for Windows.
Tạo người dùng MySQL bổ sung: ....: in this tutorial, you will learn how to start MySQL Server on Windows and Linux.
Đặt đặc quyền cho tên người dùng bổ sung ..
Tóm tắt: Trong hướng dẫn này, bạn sẽ tìm hiểu cách khởi động Máy chủ MySQL trên Windows và Linux.
sudo service mysql start
Trên Linux, bạn có thể khởi động máy chủ với các lệnh sau bằng
sudo launchctl load -F /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist
sudo launchctl unload -F /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist
4, sudo launchctl load -F /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist
sudo launchctl unload -F /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist
5 và sudo launchctl load -F /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist
sudo launchctl unload -F /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist
6.
sudo /etc/init.d/mysql start
Khởi động máy chủ MySQL bằng
sudo launchctl load -F /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist
sudo launchctl unload -F /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist
4
sudo systemctl start mysqld
Khởi động máy chủ MySQL trên Windows
Trên Windows, bạn có thể khởi động máy chủ MySQL bằng chương trình
/etc/init.d/mysqld start
/etc/init.d/mysqld stop
/etc/init.d/mysqld restart
0 như sau:Đầu tiên, hãy mở hộp thoại
/etc/init.d/mysqld start
/etc/init.d/mysqld stop
/etc/init.d/mysqld restart
1 bằng cách nhấn bàn phím /etc/init.d/mysqld start
/etc/init.d/mysqld stop
/etc/init.d/mysqld restart
2:Thứ hai, nhập
/etc/init.d/mysqld start
/etc/init.d/mysqld stop
/etc/init.d/mysqld restart
3 và nhấn /etc/init.d/mysqld start
/etc/init.d/mysqld stop
/etc/init.d/mysqld restart
4:Thứ ba, nhập
/etc/init.d/mysqld start
/etc/init.d/mysqld stop
/etc/init.d/mysqld restart
0 và nhấn /etc/init.d/mysqld start
/etc/init.d/mysqld stop
/etc/init.d/mysqld restart
4:
mysqld
Nếu thư mục
/etc/init.d/mysqld start
/etc/init.d/mysqld stop
/etc/init.d/mysqld restart
7 không nằm trong môi trường đường dẫn Windows, bạn có thể điều hướng đến thư mục bin, ví dụ: /etc/init.d/mysqld start
/etc/init.d/mysqld stop
/etc/init.d/mysqld restart
8 và sử dụng lệnh /etc/init.d/mysqld start
/etc/init.d/mysqld stop
/etc/init.d/mysqld restart
0.Trong hướng dẫn này, bạn đã học được cách khởi động máy chủ MySQL trên Windows và Linux.
Hướng dẫn này có hữu ích không?
2.3.4.6 & nbsp; Bắt đầu MySQL từ dòng lệnh Windows
Máy chủ MySQL có thể được khởi động thủ công từ dòng lệnh. Điều này có thể được thực hiện trên bất kỳ phiên bản Windows nào.
Để khởi động máy chủ MySQLD từ dòng lệnh, bạn nên khởi động cửa sổ bảng điều khiển [hoặc cửa sổ DOS DOS] và nhập lệnh này:mysqld server from the command line, you should start a console window [or “DOS window”] and enter this command:
sudo launchctl load -F /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist
sudo launchctl unload -F /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist
0Đường dẫn đến MySQLD có thể thay đổi tùy thuộc vào vị trí cài đặt của MySQL trên hệ thống của bạn.mysqld may vary depending on the install location of MySQL on your system.
Bạn có thể dừng máy chủ MySQL bằng cách thực thi lệnh này:
sudo launchctl load -F /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist
sudo launchctl unload -F /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist
1Ghi chú
Nếu tài khoản người dùng MySQL
service mysqld start
service mysqld stop
service mysqld restart
0 có mật khẩu, bạn cần gọi mysqladmin với tùy chọn service mysqld start
service mysqld stop
service mysqld restart
1 và cung cấp mật khẩu khi được nhắc.mysqladmin with the service mysqld start
service mysqld stop
service mysqld restart
1 option and supply the password when prompted. Lệnh này gọi tiện ích quản trị MySQL MySQLadmin kết nối với máy chủ và bảo nó tắt. Lệnh kết nối với tư cách là người dùng MySQL
service mysqld start
service mysqld stop
service mysqld restart
0, đây là tài khoản quản trị mặc định trong hệ thống tài trợ MySQL.mysqladmin to connect to the server and tell it to shut down. The command connects as the MySQL service mysqld start
service mysqld stop
service mysqld restart
0 user, which is the default administrative account in the MySQL grant system. Ghi chú
Nếu tài khoản người dùng MySQL
service mysqld start
service mysqld stop
service mysqld restart
0 có mật khẩu, bạn cần gọi mysqladmin với tùy chọn service mysqld start
service mysqld stop
service mysqld restart
1 và cung cấp mật khẩu khi được nhắc.Lệnh này gọi tiện ích quản trị MySQL MySQLadmin kết nối với máy chủ và bảo nó tắt. Lệnh kết nối với tư cách là người dùng MySQL
service mysqld start
service mysqld stop
service mysqld restart
0, đây là tài khoản quản trị mặc định trong hệ thống tài trợ MySQL.mysqld doesn't start, check the error log to see whether the server wrote any messages there to indicate the cause of the problem. By default, the error log is located in the service mysqld start
service mysqld stop
service mysqld restart
3 directory. It is the file with a suffix of service mysqld start
service mysqld stop
service mysqld restart
4, or may be specified by passing in the
service mysqld start
service mysqld stop
service mysqld restart
5 option. Alternatively, you can try to start the server with the service mysqld start
service mysqld stop
service mysqld restart
6 option; in this case, the server may display some useful information on the screen to help solve the problem. Người dùng trong hệ thống tài trợ MySQL hoàn toàn độc lập với bất kỳ người dùng hệ điều hành nào trong Microsoft Windows.mysqld with the
service mysqld start
service mysqld stop
service mysqld restart
7 and service mysqld start
service mysqld stop
service mysqld restart
8 options. In this case,
mysqld writes a log file service mysqld start
service mysqld stop
service mysqld restart
9 that should contain the reason why mysqld doesn't start. See Section 5.9.4, “The DBUG Package”. Nếu MySQLD không bắt đầu, hãy kiểm tra nhật ký lỗi để xem máy chủ có viết bất kỳ tin nhắn nào ở đó để chỉ ra nguyên nhân của vấn đề hay không. Theo mặc định, nhật ký lỗi được đặt trong thư mục
service mysqld start
service mysqld stop
service mysqld restart
3. Đây là tệp có hậu tố service mysqld start
service mysqld stop
service mysqld restart
4 hoặc có thể được chỉ định bằng cách truyền trong tùy chọn service mysqld start
service mysqld stop
service mysqld restart
5. Ngoài ra, bạn có thể cố gắng khởi động máy chủ với tùy chọn service mysqld start
service mysqld stop
service mysqld restart
6; Trong trường hợp này, máy chủ có thể hiển thị một số thông tin hữu ích trên màn hình để giúp giải quyết vấn đề.mysqld --verbose --help to display all the options that mysqld supports.