^ ' CHIA SẺ - KINH NGHIEM - HOC TAP - THU THUAT HARDWARE AND SOFTWARE mySQL - Part 2 - Manager mySQL Server - Backup & Restore Database Sau khi cài đặt thành công mySQL, vì lý đo bảo m
Trang 1^ '
CHIA SẺ - KINH NGHIEM - HOC TAP - THU THUAT HARDWARE AND SOFTWARE
mySQL - Part 2 - Manager mySQL Server - Backup & Restore Database
Sau khi cài đặt thành công mySQL, vì lý đo bảo mật nén mySQL Server yêu cầu mọi thao tác của bạn bây giờ đều thực hiện trên nền DOS Command cả Nghĩa là bạn phải thực thi bằng dòng lệnh rất cực nhọc y như trong Window s Server 2008 Core vậy Bạn
có thể tham khảo thêm ở đây http://dev.mysql.com/ doe/refman/5.1/en/mysal.htmI
Vì vậy để cho đơn giản mySQL có cung cấp một Tool để ta quản trị dựa trên giao diện đồ họa mà khi cài đặt mySQL không cài phần nay, ban download Tool nay vé tao hittp://dev.mysql.com/downloads/gui-tools/5.0.html
Sau khi Download hoan tat ban kich hoat file dé cai dat
re
Welcome to the Setup Wizard for MySQL Tools for 5.0
The Setup Wizard will install MYSQL Tools for 5.0 on your
computer To continue, click :
onal treaties
sae program is protected by copyright law and
in j
/Mysau
<Back |[_Next> | | Cancel
Chon Custom trong Setup Type cua mySQL Tools
Setup Type
Choose the setup type that best suits your needs
G
@”
" i Choose va features you want installed and where they
will be installed»Recommended for advanced users
[<Back || Next> || canel
CV =
Trong Custom Setup chung ta thấy có 3 phần sau đây:
- mySQL Administrator
- mySQL Query Browser
- mySQL Migration Toolit
Trang 2
# MySQL Tools for 5.0 - Setup Wizard ai’ eS a
Custom Setup
Select the program features you want installed
Click on an icon in the list below to change how a feature is HN
Common Components
MySQL Administrator
MySQL Query Browser
MySQL Migration Toolkit
Lanquage Support
c°
S
*
©
¿ature Description
1 Support for various languages
<
This feature requires OKB on
your hard drive Ithas 5 of 5 subfeatures selected The subfeatures require 4KB on your
Install to:
‹| C:\Program Files (x86)\MySQL\MySQL Tools for 5.0\
[ Help | [ Space | [ < Back IL Next> | [ Cancel
=
Qua trinh cai dat bat dau
Installing MySQL Tools for 5.0
The program features you selected are being installed
take several minutes
Status:
Please wait while the Setup Wizard installs MySQL Tag's for 5.0 This may
©
Sau khi cài đặt hoàn tất bạn vào Start -> Programs sẽ thấy xuất hiện các Tools cua mySQL
)) Mozilla Firefox
)) MSXML 4.0
J) MySQL
© MySQL Administrator
© MySQL Migration Toolkit
Z MySQL Query Browser
@ MySQL System Tray Monit C
Jj) MySQL Server 5.0 c°
}) StreamingStar về
J¿ Super Text S
_)) Total Commander
4Á Back
Kích hoạt mySQL System Tray Monitor sau đó tiếp tục nhấp phải vào icon mySQL System Tray Monitor chọn mySQL
Recent Items
Computer
Network
Connect To
Control Panel
Default Programs Help and Support
Trang 3Administrator
@ MySQL - Running
Shutdown Instance
Configure Instance
Monitoring Options
MySQL Administrator G
MySQL Query Browser ©
^"
ce ÿ' (141 10:17PM
mySQGL Administrator bật lên bạn nhập tên server của bạn vào 6 Server Host nếu sử dụng tại local thì bạn nhập là localhost Username: root
Passw ord: là mật khẩu mà khi cai dat mySQL bạn đã đặt
aan tinct sits MR,
\
MuJSGL
Connect to MySQL Server Instance °
Password: SS
| OK mì | Clear | | Cancel
Cửa sổ làm việc chính của mySQGL Administrator
Trang 4© MySQL Administrator - Connection: root@localhost:3306 = rer|:E3:
File Edit View Tools Window Help
8a User Administration
1 Server Connections
MySQc:
Connected to MySQL Server Instance
Hostname: localhost
cø Replication Status
MySQL Version: MySQL 5.0, SP TCP/IP
4
4
Network Name: vế: UYEN
Operating vả unknown
Hardware: 2x Intel(R) Core(TM)2 Duo CPU) T8100 @ 2,10GHz, 4.0 GB RAM
Bạn chú ý phần Catalogs đây chính là nơi quản ly tất cả Database có trên hệ thống của bạn
Mặc định sau khi cài đặt xong mySQL sẽ tạo các Database cho hệ thống (xem hình) vì vậy bàn không nên xóa các Database này đi
Trang 5© MySQL Administrator - Connection: root@localhost:3306 ——
File Edit View Tools Window Help
Server Information
¥ Service Control
cb Startup Variables
8a User Administration
1 Server Connections
rr Replication Status av
ý
Schemata
[PS
information_schema
| mysql
test
Để tạo một Database mới bạn nhấp phải vào vùng trống chọn Create New Schema Giả sử trong này tôi sẽ tạo một Database mới
có tên là gccom
8 information_schema
*
Copy CREATE satercftlo Clipboard Ctrl+C
Cr ew Procedure / Function Ctrl+P
IT
Để tạo bảng cho Database ban nhap phai vao Database can tao bang chon Create New Table
Trang 6oid User Administration
2 Server Connections
{i Health
Server Logs
# Replication Status
2 ì Đ
| test
| Copy CREATE statment to Clipboard Ctrl+C
Giả sử tôi tạo một Table có tên là gcNews và có 2 Row là News_ID và News Name
Nhấp Apply Change để lưu lại những thao tác của bạn Ở đây tôi sẽ không đi sâu vào phần Database mà chỉ giới thiệu sơ cho bạn biết về nguyên lý tạo Data & Table mà thôi phần chỉ tiết tôi sẽ trình bày trong các chương sau
LĂ | EI me):
Columns and Indices | Table Options | Advanced Options |
7 News_ID > INTEGER ¥ ¥_ | UNSIGNED [_] ZEROFILL
&
ff `
GC
4
Indices | Foreign Keys | Column Details | a
Như vậy ta đã tạo thành công một Database mới và một Table cho Databane này, bây giờ ta sẽ tiến hành Backup lại Database
này nhằm phòng khi có sự cố bất trắc xảy ra
Click chọn Backup chon tiép nut New Project
Trang 7Dat tén cho Project mdi vi du la Backup for gccom data
Tiếp tục chọn Data cần backup va nhdp chon Execute backup now
F © MySQL Administrator - Connection: root@localhost:3306 — _~ a bu ế ¬=" — 7 = ih Sun —- —=m a), a
| File Edit View Tools Window Help
Service Control
—* Backup Project
là Startup Variables Define the name and content of the backup
2 Server Connections Project Name: Backup for gccom data Name for this backup project
“{y) Health
|
New Project | Save Project | Execute Backup Now
`sÖ
Trước khi thực hiện quá trình Backup bạn có thể tùy chỉnh các dạng Backup bằng cách nhấp chọn Tab Advanced Options các chức năng trong này tôi sẽ giới thiệu chi tiết trong các chương sau và nếu không có gì phức tạp thì bạn nên để nguyên giá trị mặc định trong phần Backup nay
Trang 8© MySQL Administrator - Connection: root@localhost3306
| File Edit View Tools Window Help
Server Information
ự Service Control
Ch Startup Variables
8a User Administration
c1 Server Connections
i) Health
Server Logs
cø Replication Status
Q Backup
Backup Projects
i2
Backup Project | Advanced Options | Schedule
SỐ Advanced Options Specify detailed settings of how your backup should be performed Backup Execution Method
@ InnoDB Online Backup
© Lock all tables
© Online with binlog pos
© Normal backup Complete backup
Output File Options
The backup will be executed in a single transaction, This option is necessary to create
a consistent snapshot of your InnoDB tables
All tables are locked with FLUSH READ LOCKS This option is necessary to create a consistent snapshot of your MyISAM tables
This backup method is the same as InnoDB Online Backup but also logs the current position of the binlo é option is activated for the server
Each table will be and should be
ed up independently This may lead to inconsistent backups ided if possible,
Backup fables Use this option if tables are added to schemas frequently Note:
your G p content table selection will be ignored
2
Backup Type: SOL Ei v Type of generated backup file
[_] Optimized commit
New Project | Save Project | Execute Backup Now
Ne
Để Restore Database ban Click chon Restore chon tiép nit Open Backup file dé chon File ma bạn đã Backup trước đó
Original schema: Sé Restore lén Database cling tén cling password
Another schema: Sé Restore Ilén Database do ban chi dinh
File Charset: dinh dang ma van ban ma ban muén Restore théng thường là UTF-8
Trang 9
© MySQL Administrator - Connection: root@localhost:3306
|| File Edit View Tools Window Help
Server Information
Service Control
gà Startup Variables
Aa User Administration
c1 Server Connections
{i Health
Server Logs
ig Replication Status
Q Backup
Do
cu» Restore
i Catalogs
General
* Restore Options
ca Please select how the backup should be restored
Restore Content
General
File to restore:
*
Create database(s) if neg exist
Character Set KY
Name of the backup file that
`
If you are importing a SQL file that has not been created
with MySQL Administrator, you have to choose the correct character set of the file If you have created the backup \ with MySQL Administrator the file was written in UTF-8
Open Backup File | | Start Restore
OK mình vừa trình bài xong phần Manager mySQL Server - Backup & Restore Database
Công ty TNHH đầu tư phát triển tin học GC Com Chuyên trang kỹ thuật máy vi tính cho kỹ thuật viên tin học
Điện thoại: (073) - 3.511.373 - 6.274.294
Website: http://www.gccom.net