I have a data base that includes one file .opt and a three files .frm .mid .myd for each entity in this DB.
can anyone help me with importing this data base to mySql?
Thanks
Do you mean .MYI instead of *.MID.
Filename with extensions .FRM .MYD .MYI in MySQL are MyISAM Tables. You can just simply copy these files into database folder.
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)
Related
GOAL:
I am trying to run mysql on my work servers machines. But as admins did not install it in the usual default installation path, it fails. How can I make it works?
FACTS:
MySQL is installed under: /opt/mysql/10.1.16/
$> ls -1 /opt/mysql/10.1.16/
bin
COPYING
COPYING.LESSER
COPYING.thirdparty
CREDITS
data
EXCEPTIONS-CLIENT
include
INSTALL-BINARY
lib
man
mysql-test
README
README-wsrep
scripts
share
sql-bench
support-files
However, when I want to run mysql from a script, I do:
export LIBMYSQL_PLUGIN_DIR="/opt/mysql/10.1.16/lib/plugin"
export LD_LIBRARY_PATH="/opt/mysql/10.1.16/lib"
export LD_RUN_PATH="/opt/mysql/10.1.16/lib"
export PATH="/opt/mysql/10.1.16/bin:/home/xxxxxxxx/bin:/usr/local/bin:/usr/bin:/bin:/usr/lib64/jvm/jre/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin"
/opt/mysql/10.1.16/bin/mysql -C --no-beep --line-numbers --protocol=TCP --host="${DB_HOSTNAME}" --port="${DB_PORT}" --user="${DB_USER}" --database "${DB_SCHEMA}" -o --delimiter ','
With all my DB_xxxx corectly set, I get the following error:
ERROR 2059 (HY000): Authentication plugin 'dialog' cannot be loaded: /usr/local/mysql/lib/plugin/dialog.so: cannot open shared object file: No such file or directory
I checked the official documentation page:
https://dev.mysql.com/doc/refman/8.0/en/environment-variables.html and the only mention about plugin is to check if LIBMYSQL_PLUGIN_DIR, which seems good since:
$> echo "${LIBMYSQL_PLUGIN_DIR}"
/opt/mysql/10.1.16/lib/plugin
$> ls -la /opt/mysql/10.1.16/lib/plugin
-rwxr-xr-x 1 mysql dba 17382 Sep 13 2016 adt_null.so
-rwxr-xr-x 1 mysql dba 12462 Sep 13 2016 auth_0x0100.so
-rwxr-xr-x 1 mysql dba 33039 Sep 13 2016 auth_gssapi_client.so
-rwxr-xr-x 1 mysql dba 80774 Sep 13 2016 auth_gssapi.so
-rwxr-xr-x 1 mysql dba 18007 Sep 13 2016 auth_pam.so
-rwxr-xr-x 1 mysql dba 13028 Sep 13 2016 auth_socket.so
-rwxr-xr-x 1 mysql dba 23521 Sep 13 2016 auth_test_plugin.so
-rw-r--r-- 1 mysql dba 227 Sep 13 2016 daemon_example.ini
-rwxr-xr-x 1 mysql dba 15267 Sep 13 2016 debug_key_management.so
-rwxr-xr-x 1 mysql dba 14975 Sep 13 2016 dialog_examples.so
-rwxr-xr-x 1 mysql dba 39102 Sep 13 2016 dialog.so
-rwxr-xr-x 1 mysql dba 35337 Sep 13 2016 example_key_management.so
-rwxr-xr-x 1 mysql dba 67516 Sep 13 2016 file_key_management.so
-rwxr-xr-x 1 mysql dba 534847 Sep 13 2016 ha_archive.so
-rwxr-xr-x 1 mysql dba 326244 Sep 13 2016 ha_blackhole.so
-rwxr-xr-x 1 mysql dba 6315641 Sep 13 2016 ha_connect.so
-rwxr-xr-x 1 mysql dba 270829 Sep 13 2016 ha_example.so
-rwxr-xr-x 1 mysql dba 408688 Sep 13 2016 ha_federated.so
-rwxr-xr-x 1 mysql dba 658050 Sep 13 2016 ha_federatedx.so
-rwxr-xr-x 1 mysql dba 17067973 Sep 13 2016 ha_innodb.so
-rwxr-xr-x 1 mysql dba 13007344 Sep 13 2016 ha_mroonga.so
-rwxr-xr-x 1 mysql dba 1586135 Sep 13 2016 handlersocket.so
-rwxr-xr-x 1 mysql dba 1687004 Sep 13 2016 ha_oqgraph.so
-rwxr-xr-x 1 mysql dba 745005 Sep 13 2016 ha_sphinx.so
-rwxr-xr-x 1 mysql dba 5150095 Sep 13 2016 ha_spider.so
-rwxr-xr-x 1 mysql dba 226800 Sep 13 2016 ha_test_sql_discovery.so
-rwxr-xr-x 1 mysql dba 35898 Sep 13 2016 libdaemon_example.so
-rwxr-xr-x 1 mysql dba 131020 Sep 13 2016 locales.so
-rwxr-xr-x 1 mysql dba 221483 Sep 13 2016 metadata_lock_info.so
-rwxr-xr-x 1 mysql dba 18211 Sep 13 2016 mypluglib.so
-rwxr-xr-x 1 mysql dba 16382 Sep 13 2016 mysql_clear_password.so
-rwxr-xr-x 1 mysql dba 18751 Sep 13 2016 qa_auth_client.so
-rwxr-xr-x 1 mysql dba 24478 Sep 13 2016 qa_auth_interface.so
-rwxr-xr-x 1 mysql dba 13542 Sep 13 2016 qa_auth_server.so
-rwxr-xr-x 1 mysql dba 229059 Sep 13 2016 query_cache_info.so
-rwxr-xr-x 1 mysql dba 286720 Sep 13 2016 query_response_time.so
-rwxr-xr-x 1 mysql dba 534415 Sep 13 2016 semisync_master.so
-rwxr-xr-x 1 mysql dba 445144 Sep 13 2016 semisync_slave.so
-rwxr-xr-x 1 mysql dba 175928 Sep 13 2016 server_audit.so
-rwxr-xr-x 1 mysql dba 32295 Sep 13 2016 simple_password_check.so
-rwxr-xr-x 1 mysql dba 19846 Sep 13 2016 sql_errlog.so
-rwxr-xr-x 1 mysql dba 218688 Sep 13 2016 wsrep_info.so
All libraries have execution rights, they are all here BUT MYSQL is still trying to search in the default path /usr/local/mysql/lib/plugin/. And of course on our machine, this path does not exist.
QUESTION:
Is there another option/way to specifically ask mysql to load plugin for a specific directory?
NOTES:
I found some links about the error ERROR 2059 (HY000): Authentication plugin 'dialog' cannot be loaded: /usr/local/mysql/lib/plugin/dialog.so: cannot open shared object file: No such file or directory but solutions are all:
Uninstall mysql and install it again (which I can't)
Create the directory or symlink (I can't neither)
Use the --enable-cleartext-plugin option (it does nothing and I don't think it is related in my case)
So I think I understood why.
Setting LIBMYSQL_PLUGIN_DIR:
export LIBMYSQL_PLUGIN_DIR="/opt/mysql/10.1.16/lib/plugin"
is somehow not read or taken in account.
However, adding directly to the binary the option --plugin-dir="${LIBMYSQL_PLUGIN_DIR}" will make it work.
So correct answer is:
/opt/mysql/10.1.16/bin/mysql --plugin-dir="${LIBMYSQL_PLUGIN_DIR}" -C --no-beep --line-numbers --protocol=TCP --host="${DB_HOSTNAME}" --port="${DB_PORT}" --user="${DB_USER}" --database "${DB_SCHEMA}" -o --delimiter ','
Why the env varibale is not read, that is a mystery
i find lot's of ibd file in my mysql server datadir ,what is it ? mysql version is 5.7.12 , strange things is they are all no frm file
-rw-r----- 1 mysql mysql 84M Aug 20 13:56 FTS_0000000000002fe2_000000000000694c_INDEX_1.ibd
-rw-r----- 1 mysql mysql 12M Aug 20 13:55 FTS_0000000000002fe2_000000000000694c_INDEX_2.ibd
-rw-r----- 1 mysql mysql 7.0M Aug 20 13:52 FTS_0000000000002fe2_000000000000694c_INDEX_3.ibd
-rw-r----- 1 mysql mysql 496K Aug 20 13:52 FTS_0000000000002fe2_000000000000694c_INDEX_4.ibd
-rw-r----- 1 mysql mysql 448K Aug 20 13:53 FTS_0000000000002fe2_000000000000694c_INDEX_5.ibd
-rw-r----- 1 mysql mysql 7.0M Aug 20 13:55 FTS_0000000000002fe2_000000000000694c_INDEX_6.ibd
-rw-r----- 1 mysql mysql 96K Aug 20 13:46 FTS_0000000000002fe2_BEING_DELETED_CACHE.ibd
-rw-r----- 1 mysql mysql 96K Aug 20 13:46 FTS_0000000000002fe2_BEING_DELETED.ibd
-rw-r----- 1 mysql mysql 96K Aug 20 13:56 FTS_0000000000002fe2_CONFIG.ibd
-rw-r----- 1 mysql mysql 96K Aug 20 13:46 FTS_0000000000002fe2_DELETED_CACHE.ibd
-rw-r----- 1 mysql mysql 96K Aug 20 13:46 FTS_0000000000002fe2_DELETED.ibd
-rw-r----- 1 mysql mysql 396M Aug 21 20:59 FTS_000000000000304c_00000000000069eb_INDEX_1.ibd
-rw-r----- 1 mysql mysql 40M Aug 21 20:58 FTS_000000000000304c_00000000000069eb_INDEX_2.ibd
-rw-r----- 1 mysql mysql 11M Aug 21 20:58 FTS_000000000000304c_00000000000069eb_INDEX_3.ibd
-rw-r----- 1 mysql mysql 10M Aug 21 20:58 FTS_000000000000304c_00000000000069eb_INDEX_4.ibd
-rw-r----- 1 mysql mysql 9.0M Aug 21 20:58 FTS_000000000000304c_00000000000069eb_INDEX_5.ibd
-rw-r----- 1 mysql mysql 10M Aug 21 20:58 FTS_000000000000304c_00000000000069eb_INDEX_6.ibd
-rw-r----- 1 mysql mysql 96K Aug 21 20:32 FTS_000000000000304c_00000000000069f2_INDEX_1.ibd
-rw-r----- 1 mysql mysql 848M Aug 21 20:59 FTS_000000000000304c_00000000000069f2_INDEX_2.ibd
-rw-r----- 1 mysql mysql 96K Aug 21 20:32 FTS_000000000000304c_00000000000069f2_INDEX_3.ibd
-rw-r----- 1 mysql mysql 96K Aug 21 20:32 FTS_000000000000304c_00000000000069f2_INDEX_4.ibd
-rw-r----- 1 mysql mysql 96K Aug 21 20:32 FTS_000000000000304c_00000000000069f2_INDEX_5.ibd
-rw-r----- 1 mysql mysql 96K Aug 21 20:32 FTS_000000000000304c_00000000000069f2_INDEX_6.ibd
and i check two of these file ,find some content , i can not know.
# strings FTS_0000000000003c97_BEING_DELETED_CACHE.ibd
infimum
supremum
# strings FTS_0000000000003c97_CONFIG.ibd
infimum
supremum
|cache_size_in_mb
1optimize_checkpoint_limit
Jsynced_doc_id
deleted_doc_count
!table_state
,use_stopword
The FTS_*.ibd files are the InnoDB FULLTEXT Search (FTS) index files. InnoDB introduced Full Text Searching from MySQL version 5.6 and onwards. They store only FTS indexing data. You possibly have some InnoDB table(s) with FTS defined on few field(s).
Indexing data is split up into 6 partitions. The ...INDEX_1.ibd to ...INDEX_6.ibd table files contain the FTS index data (6 parts).
FTS_DELETED and FTS__DELETED_CACHE
Contain the document IDs (DOC_ID) for documents that are deleted but
whose data is not yet removed from the full-text index. The
FTS_DELETED_CACHE is the in-memory version of the FTS_DELETED
table.
FTS__BEING_DELETED and FTS__BEING_DELETED_CACHE
Contain the document IDs (DOC_ID) for documents that are deleted and
whose data is currently in the process of being removed from the
full-text index. The FTS_BEING_DELETED_CACHE table is the in-memory
version of the FTS_BEING_DELETED table.
FTS_CONFIG
Stores information about the internal state of the FULLTEXT index.
From MySQL 5.6.6 and higher, InnoDB engine enabled innodb_file_per_table approach. From Docs:
Historically, InnoDB tables were stored in the system tablespace....
[Now] each InnoDB table is stored in its own tablespace data file (.ibd
file). This feature is controlled by the innodb_file_per_table
configuration option, which is enabled by default.
More from the docs:
With innodb_file_per_table enabled, you can store InnoDB tables in a
tbl_name.ibd file. Unlike the MyISAM storage engine, with its separate
tbl_name.MYD and tbl_name.MYI files for indexes and data, InnoDB
stores the data and the indexes together in a single .ibd file. The
tbl_name.frm file is still created as usual.
I am new to mariadb. Today, I was attempting to import a mysql database to mariadb and during the process the import stops when a warning is encountered as shown below.
Now, I said to myself that I should check a log file so I can see the error but I can't seem to fine any log file. I ran the query below with help from Get the error log of Mariadb:
As you can see there is no path to an error log file.
Next I checked /var/lib/mysql and below is the dir content:
-rw-rw----. 1 mysql mysql 16384 Jun 5 16:03 aria_log.00000001
-rw-rw----. 1 mysql mysql 52 Jun 5 16:03 aria_log_control
-rw-rw----. 1 mysql mysql 79691776 Jun 8 08:02 ibdata1
-rw-rw----. 1 mysql mysql 50331648 Jun 8 08:02 ib_logfile0
-rw-rw----. 1 mysql mysql 50331648 Jun 5 16:03 ib_logfile1
-rw-rw----. 1 mysql mysql 6 Jun 5 16:12 IMSPRO.pid
drwx------. 2 mysql mysql 4096 Jun 8 08:02 ecommence
-rw-rw----. 1 mysql mysql 0 Jun 5 16:12 multi-master.info
drwx--x--x. 2 mysql mysql 4096 Jun 5 16:03 mysql
srwxrwxrwx. 1 mysql mysql 0 Jun 5 16:12 mysql.sock
drwx------. 2 mysql mysql 20 Jun 5 16:03 performance_schema
-rw-rw----. 1 mysql mysql 24576 Jun 5 16:12 tc.log
No file in the above dir logs error.
Below is the content of my /etc/my.cnf
#
# This group is read both both by the client and the server
# use it for options that affect everything
#
[client-server]
#
# include all files from the config directory
#
!includedir /etc/my.cnf.d
Below is the content of /etc/my.cnf.d
drwxr-xr-x. 2 root root 117 Jun 5 16:02 .
drwxr-xr-x. 91 root root 8192 Jun 7 01:14 ..
-rw-r--r--. 1 root root 295 May 29 16:48 client.cnf
-rw-r--r--. 1 root root 763 May 29 16:48 enable_encryption.preset
-rw-r--r--. 1 root root 232 May 29 16:48 mysql-clients.cnf
-rw-r--r--. 1 root root 1080 May 29 16:48 server.cnf
-rw-r--r--. 1 root root 285 May 29 16:48 tokudb.cnf
What can I do to get error log?
The way to see the warnings is to type this immediately after receiving that "Warnings: 1":
SHOW WARNINGS;
(As soon as the next other command is run, the warnings are cleared.)
In mariadb version 10.3.29,
#show variables like 'log-error';
is showing "Empty set" output
Instead, the following command is working
show global variables like 'log_error';
In my case, I edited /etc/my.cnf and added the line log_error after [mysqld]:
[mysqld]
...
log_error
After that, the query show variables like 'log_error'; displays the following (before the change, the Value column was empty):
+---------------+--------------------------+
| Variable_name | Value |
+---------------+--------------------------+
| log_error | /var/lib/mysql/host.err |
+---------------+--------------------------+
Now the error log is being written to the above file.
The exact name of the file will vary from server to server and will take the name of the current host, so expect it to be different in your particular case.
I've got a big database with about 240Gb of data and indexes (as read from phpMyAdmin - My tables are in innodb). The database folder on the server however, has the size close to 400Gb, while my ibdata1 file has the size about 6Gb, causing to ran out of space on my SSD.
I investigated this and it seems that there are many files like FTS_0000000000000f86_00000000000019db_INDEX_1.ibd with tens of gigabytes in size. They seem (based on their filenames) my fulltext indexes for their associated tables, and there are 6 of each (FTS_*_INDEX_1.ibd to FTS_*_INDEX_6.ibd).
I've done my searches and have came across these posts:
Howto: Clean a mysql InnoDB storage engine?
and
Database space doesn't match ibdata1 size
I've asked my question in comments on these two questions/answers with no reply yet. So I decided to directly ask my question here.
If I do the 'InnoDB Cleanup' with innodb_file_per_table enabled (as suggested in the first link above), would I still have lots of these huge files starting like FTS_\*_INDEX_1.ibd in my database folder? Is this approach only helping to reduce ibdata1 file size? Would regular OPTIMIZE TABLE on these huge tables (as suggested) help me regarding my problem?
Thanks!
UPDATE:
Here is the list of files bigger than 1Gb reverse sorted by file size (filenames are altered):
-rw-rw----. 1 mysql mysql 1300234240 Jan 30 18:28 FTS_0000000000000fc2_DELETED.ibd
-rw-rw----. 1 mysql mysql 1375731712 Jan 7 21:41 FTS_0000000000000f86_00000000000019db_INDEX_1.ibd
-rw-rw----. 1 mysql mysql 1585446912 Jan 30 23:17 FTS_0000000000001000_0000000000001a68_INDEX_1.ibd
-rw-rw----. 1 mysql mysql 1593835520 Jan 7 21:41 FTS_0000000000000f86_00000000000019bf_INDEX_1.ibd
-rw-rw----. 1 mysql mysql 1673527296 Jan 29 23:41 FTS_0000000000001000_DELETED.ibd
-rw-rw----. 1 mysql mysql 1824522240 Jan 7 21:41 FTS_0000000000000f86_00000000000019cd_INDEX_1.ibd
-rw-rw----. 1 mysql mysql 2172649472 Jan 30 01:16 FTS_0000000000001073_0000000000001b3c_INDEX_1.ibd
-rw-rw----. 1 mysql mysql 2281701376 Jan 7 21:41 FTS_0000000000000f86_00000000000019b1_INDEX_1.ibd
-rw-rw----. 1 mysql mysql 2357198848 Jan 31 02:53 FTS_0000000000000fc2_0000000000001a0f_INDEX_1.ibd
-rw-rw----. 1 mysql mysql 2495610880 Jan 28 13:59 FTS_0000000000000fc2_0000000000001a2b_INDEX_1.ibd
-rw-rw----. 1 mysql mysql 2906652672 Jan 30 23:18 FTS_0000000000001000_0000000000001a76_INDEX_1.ibd
-rw-rw----. 1 mysql mysql 3984588800 Jan 30 23:18 FTS_0000000000001000_0000000000001a6f_INDEX_1.ibd
-rw-rw----. 1 mysql mysql 4135583744 Jan 30 08:03 FTS_0000000000000fc2_00000000000019fa_INDEX_1.ibd
-rw-rw----. 1 mysql mysql 5716836352 Jan 28 13:59 FTS_0000000000000fc2_0000000000001a01_INDEX_1.ibd
-rw-rw----. 1 mysql mysql 6400507904 Jan 31 05:39 my_k.ibd
-rw-rw----. 1 mysql mysql 7449083904 Jan 7 21:41 FTS_0000000000000f86_00000000000019d4_INDEX_1.ibd
-rw-rw----. 1 mysql mysql 8115978240 Jan 7 21:41 FTS_0000000000000f86_00000000000019c6_INDEX_1.ibd
-rw-rw----. 1 mysql mysql 8308916224 Jan 30 08:03 FTS_0000000000000fc2_0000000000001a16_INDEX_1.ibd
-rw-rw----. 1 mysql mysql 8434745344 Jan 7 21:41 FTS_0000000000000f86_00000000000019b8_INDEX_1.ibd
-rw-rw----. 1 mysql mysql 9244246016 Jan 7 21:41 FTS_0000000000000f86_00000000000019aa_INDEX_1.ibd
-rw-rw----. 1 mysql mysql 9714008064 Jan 30 01:16 my_a.ibd
-rw-rw----. 1 mysql mysql 12738101248 Jan 31 05:43 my_s.ibd
-rw-rw----. 1 mysql mysql 14038335488 Jan 31 02:53 FTS_0000000000000fc2_0000000000001a24_INDEX_1.ibd
-rw-rw----. 1 mysql mysql 19906166784 Jan 30 08:03 FTS_0000000000000fc2_0000000000001a1d_INDEX_1.ibd
-rw-rw----. 1 mysql mysql 21185429504 Jan 31 05:43 my_p_s.ibd
-rw-rw----. 1 mysql mysql 29242687488 Jan 31 02:54 FTS_0000000000000fc2_0000000000001a32_INDEX_1.ibd
-rw-rw----. 1 mysql mysql 30131879936 Jan 5 16:35 my_p.ibd
-rw-rw----. 1 mysql mysql 47085256704 Jan 31 05:43 my_a_c.ibd
-rw-rw----. 1 mysql mysql 76499910656 Jan 31 05:43 my_p_c.ibd
-rw-rw----. 1 mysql mysql 76743180288 Jan 30 00:09 my_r.ibd
As you suspected, the FTS_*.ibd files are the InnoDB FULLTEXT index files. The best way to shrink those files is typically to drop and recreate your FULLTEXT indexes. Doing an OPTIMIZE TABLE may or may not help, depending on whether you have innodb_optimize_fulltext_only enabled, but the safest bet to reclaim space is the drop/add.
On an insert-only workload the drop/add will usually make the files smaller, and if those tables get a large volume of updates and/or deletes then the size savings of a drop/add should be even greater. The presence of large FTS_*_DELETED.ibd files implies that you have deleted some data from those tables, so doing a drop/add of the indexes will save you some disk space.
You can use SHOW CREATE TABLE to find out the names and columns of the existing FULLTEXT indexes in order to recreate them properly.
For example:
mysql > show create table your_table\G
*************************** 1. row ***************************
Table: your_table
Create Table: CREATE TABLE `your_table` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`col1` varchar(255) DEFAULT NULL,
`col2` varchar(255) DEFAULT NULL,
...
PRIMARY KEY (`id`),
FULLTEXT KEY `fti_idx` (`col1`,`col2`)
) ENGINE=InnoDB;
1 row in set (0.00 sec)
Then you can drop and add the index in a single ALTER TABLE statement:
alter table your_table
drop index fti_idx,
add fulltext index fti_idx (col1,col2);
The *.ibd files are all InnoDB tablespace files. They contain data and/or indexes for InnoDB tables that are stored in the file-per-table manner. Typically the filenames match the table they store, as you have no doubt figured out.
The FTS_*.ibd files are indexes for InnoDB's implementation of full-text index. This is a new feature introduced in MySQL 5.6, and there's not much documented knowledge about the storage characteristics. Apparently they are pretty bulky for some reason. I have no idea if OPTIMIZE TABLE has any effect on the fulltext indexes.
One way you might get rid of these big files is of course to drop any fulltext indexes you defined for InnoDB tables.
Some other fulltext indexing product like ElasticSearch or Apache Solr or Sphinx Search may store their indexes more compactly. I did a comparison of the fulltext indexing solutions here:
Full Text Search Throwdown
InnoDB's fulltext index is the slowest solution I tested, other than table-scans with LIKE '%pattern%'.
I just installed mysql for the first time and created a databse with create database foo;
I think I have found where mysql stores the databases (/var/lib/mysql). When I try to cd to the foo directory I get permission denied. When I try with sudo nothing happens.
output of ls -l
-rw-rw----. 1 mysql mysql 16384 Feb 21 17:44 aria_log.00000001
-rw-rw----. 1 mysql mysql 52 Feb 21 17:44 aria_log_control
drwx------. 2 mysql mysql 4096 Mar 1 22:08 foo
-rw-rw----. 1 mysql mysql 18874368 Feb 21 17:44 ibdata1
-rw-rw----. 1 mysql mysql 5242880 Mar 1 16:05 ib_logfile0
-rw-rw----. 1 mysql mysql 5242880 Feb 21 17:34 ib_logfile1
drwx------. 2 mysql mysql 4096 Feb 21 17:34 mysql
srwxrwxrwx. 1 mysql mysql 0 Mar 1 16:05 mysql.sock
drwx------. 2 mysql mysql 4096 Feb 21 17:34 performance_schema
I know your meant to view the databases and stuff through that application on the command line but I am interested as to why I can't view the foo directory when i am root.
You can't view the foo directory because of the permissions:
owner - mysql - read, write, execute
group - mysql - no access
other - no access
First connect to mysql from command prompt using
[root#host]# mysql -u root -p
Enter password:******
Now select the database using
mysql> USE DB_Name
You can use belo command to have the list of databases
mysql> SHOW DATABASES;
To get the directory details you can use
mysql -uUSER -p -e 'SHOW VARIABLES WHERE Variable_Name = "dir_name"