June 26, 2015

Các phương thức import cơ sở dữ liệu MySQL

1. Giới thiệu:
Trong trường hợp bạn muốn sử dụng cơ sở dữ liệu mới, bạn cần sử dụng chức năng "Tạo cơ sở dữ liệu mới" trong cPanel. Bài viết này hướng dẫn các bạn cách Import cơ sở dữ liệu MySQL.

2. Cách thực hiện Import:
a. Import cơ sở dữ liệu sử dụng phpMyAdmin: Phương thức này thích hợp khi bạn import cơ sở dữ liệu đơn giản, import từ các định dạng khác hoặc import một phần cơ sở dữ liệu.
Sau khi xác định cơ sở dữ liệu bạn muốn sử dụng, bạn kích hoạt hệ thống quản lý phpMyAdmin trong cPanel và làm theo các bước sau:
1. Chọn cơ sở dữ liệu bạn muốn dùng ở danh sách bên trái trong giao diện của phpMyAdmin.
2. phpMyAdmin sẽ hiển thị chi tiết cấu trúc của cơ sở dữ liệu đó, với các tab ở phía trên.
3. Chọn tab Import, phpMyAdmin sẽ hiển thị hộp thoại để upload file cơ sở dữ liệu. Bạn bấm vào nútBrowse và chọn file chứa dữ liệu cần import.
4. Sau khi chọn được file cần thiết, bấm nút Go (bạn nên để các cấu hình khác của giao diện import ở giá trị mặc định). phpMyAdmin sẽ cần thời gian để upload và import cơ sở dữ liệu mới cho bạn. Chú ý không đóng cửa sổ trình duyệt và chờ đến khi tác vụ hoàn tất.

b. Import cơ sở dữ liệu qua SSH: Phương thức này đặc biệt thuận tiện khi bạn cần import cơ sở dữ liệu với dung lượng lớn (thường gây ra lỗi timeout khi upload/import qua http).
Đầu tiên bạn cần upload cơ sở dữ liệu mới (để import) lên máy chủ. Bạn nên đăng nhập và upload qua FTP (sử dụng binary mode nếu cần thiết - xem hướng dẫn). Sau đó qua SSH bạn sử dụng dòng lệnh sau
mysql --protocol tcp -h 127.0.0.1 -u username -p database_name < /đường_dẫn_tới_file_dữ_liệu.sql
trong đó username là tên đăng nhập vào cPanel của bạn, database_name là tên cơ sở dữ liệu bạn muốn sử dụng. Bạn có thể xem thêm hướng dẫn sử dụng SSH tại đây.
- Import cơ sở dữ liệu qua hệ thống sao lưu & phục hồi: Đăng nhập vào cPanel và sử dụng chức năng Quản lý sao lưu & phục hồi trong phần Quản lý trang web tại danh mục bên trái. Phương thức này thuận tiện để import các cơ sở dữ liệu bạn đã sao lưu qua hệ thống sao lưu & phục hồi của cPanel.

Related Posts:

  • Disk Space for MySQL Databases in cPanel Show as 0MB When you upgrade from cPanel 11.24 to 11.25, your users may notice that in cPanel, their MySQL databases show 0MB of disk space used, when they know their databases are much larger. This is due to an option in cPanel that yo… Read More
  • Restoring Database Privileges I’ve seen several cases in the last few months where database users seemingly “disappear” or privileges appear to become invalid when restoring MySQL data or an entire server from raw backups. This may commonly be attributed… Read More
  • MySQL Basics Install MySQL Server Debian/Ubuntu [mitesh@Matrix ~]$ sudo apt-get update && sudo apt-get install -y mysql-server Redhat/CentOS [mitesh@Matrix ~]$ sudo yum install -y mysql-server Important Files Configuratio… Read More
  • Installing Custom MySQL Versions If at all possible, you should use WHM to install MySQL, however, if you need a version of MySQL outside of what they are offering in current cPanel versions, it is possible to install your own versions. These instructions … Read More
  • How to Change the Location of MySQL on cPanel There may be some situations where you have to move the location of MySQL, for example, if you’re out of disk space or perhaps looking to host it on another device to increase performance. Whatever the reason, moving MySQL i… Read More

0 comments:

Post a Comment