我有一个数据库,其中包括一个文件.opt和三个文件.frm.mid.myd,用于此数据库中的每个实体。
有人能帮我把这个数据库导入mySql吗?
感谢
你是说。MYI而不是*。中等
带有扩展名的文件名。FRM。MYD。MySQL中的MYI是MyISAM表。您可以简单地将这些文件复制到数据库文件夹中。
mysql> create database myDatabase;
Query OK, 1 row affected (0.00 sec)
mysql> quit
Bye
[root@venus cart]# ls tt*.*
tt.frm tt.MYD tt.MYI
[root@venus cart]# cp tt.* /var/lib/mysql/myDatabase/
[root@venus cart]#
[root@venus cart]#
[root@venus cart]# cd /var/lib/mysql/myDatabase/
[root@venus myDatabase]# ll
total 24
-rw-rw----. 1 mysql mysql 65 Apr 15 10:36 db.opt
-rw-r-----. 1 root root 8582 Apr 15 10:37 tt.frm
-rw-r-----. 1 root root 18 Apr 15 10:37 tt.MYD
-rw-r-----. 1 root root 3072 Apr 15 10:37 tt.MYI
[root@venus myDatabase]# chown mysql.mysql tt.*
[root@venus myDatabase]# ll
total 24
-rw-rw----. 1 mysql mysql 65 Apr 15 10:36 db.opt
-rw-r-----. 1 mysql mysql 8582 Apr 15 10:37 tt.frm
-rw-r-----. 1 mysql mysql 18 Apr 15 10:37 tt.MYD
-rw-r-----. 1 mysql mysql 3072 Apr 15 10:37 tt.MYI
[root@venus myDatabase]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 4
Server version: 5.5.36 MySQL Community Server (GPL)
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
mysql> use myDatabase;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> SELECT * FROM tt;
+----+------+
| id | c1 |
+----+------+
| 2 | 3 |
| 3 | 2 |
+----+------+
2 rows in set (0.00 sec)