Being a terminal fan myself, I usually find myself running
queries in the mysql client instead of a UI interface as it is
much faster. You get to see the results instantaneously.
One thing which is pretty tedious is editing a big query again
after once running it as the whole multi-line formatted query now
appears on a single line, thus reducing its readability.
But no problems, you can edit your query from a file and run the
file from your mysql client terminal as many times as you want
with as many edits.
To do so, follow the below steps:
1. Open your terminal and cd into the folder you want to
store our sample mysql file. Then save your query in a sample
file called my_query.sql
$ cd /path/to/folder
$ vim my_query.sql
Save a sample query like:
SELECT * FROM employees
WHERE type LIKE …
MySQL accesses files in various places on the file system, and usually this isn't something to worry about. For example, in a standard MySQL 5.5 installation on Ubuntu, the data goes in /var/lib/mysql, and the socket is a file in /var/run/mysqld. It puts configuration files in /etc, logs and binaries in various locations, and it even needs to access some operating system files such as /etc/hosts.allow.
This is all very well until you start trying to be clever and get MySQL to access other parts of the file system. After all, you can configure the location of data, log files, socket, and so on, so why shouldn't you use those settings to optimize your system? Unfortunately, on many modern Linux distributions, it's not that always easy.
Take Ubuntu, for example. Ubuntu comes with something called AppArmor, a kernel-integrated application security system that controls how applications can access the file system. This goes above …
[Read more]SetupWe have one InnoDB file per table on our database, which was set with the following option: innodb_file_per_table.This allows me to portably transport Innodb files on a system level with minimal hassle, and is much faster than mysqldump, as these tables are several GB each.ProblemWhen transporting an .idb file from one server to another, I ran into the following error:ERROR 1030 (HY000): Got