...Right after that we had a look into the logrotation-configuration and saw that the mysqladmin-command is used to check if the server is running in order to rotate...
...log flush-slow-log fi endscript } From the documentation of the parameter ping of the mysqladmin-command we can see that the command tries to access the database and if...
MySQL and MariaDB have an SQL mode setting which changes how MySQL behaves. The SQL mode value is comprised of multiple flags like "STRICT_TRANS_TABLES, NO_ZERO_IN_DATE...
...or disables a particular behavior. The default SQL mode varies widly between versions of MySQL and MariaDB. In general, more recent versions of MySQL and MariaDB have stricter settings than...
The result might look like this: +------------------+----------+--------------+------------------+ | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | +------------------+----------+--------------+------------------+ | mysql-bin.000001 | 1219 | | | +------------------+----------+--------------+------------------+ Dump the database (in a new terminal): mysqldump -uroot -p -r...
...HOST='127.0.0.1', MASTER_PORT=3307, MASTER_USER='replicator', MASTER_PASSWORD='some_password', MASTER_LOG_FILE='mysql-bin.000001', MASTER_LOG_POS=1219; MASTER_HOST and MASTER_PORT are set to...
...to use encrypted connections between your application and RDS instances. If you're using MySQL on RDS, here's what to do: Download the AWS CA file and copy it...
...further details of the SSL configuration (such as public key). Try to connect using MySQL client % mysql -uyour_username -p -h rds_hostname_from_management_cockpit.eu-west-1.rds.amazonaws.com --ssl --ssl-ca=/path/to/mysql-ssl-ca-cert.pem Use this statement to...
...create an int column, which is smaller than a bigint. These are values for MySQL. At least on PostgreSQL you can just use bigint instead of integer: create_table :example...
...hosts non-critical development data and only you have access to, you can store MySQL's root password in your home directory so you can use mysql commands without prompt...
user=root password=YOURMYSQLROOTPASSWORDHERE EOF Now you should be able to just type mysql and be logged in as MySQL's root user. This works for different MySQL commands...
...itself did not work for me. Uninstall everything related to MySQL 5.7 with apt remove mysql-client mysql-server libmysqlclient-dev mysql-common Check if you removed everything using
...MySQL 5.6" and "Ubuntu Wily" (assuming Xenial is not yet provided) Run apt-cache policy mysql-server If this shows a 5.6 version, continue. If not, check your /etc/apt/sources.list.d/mysql.list. It...
To show the collation of your tables you have to login to the MySQL console and execute SHOW TABLE STATUS FROM database; mysql> SHOW TABLE STATUS FROM test; +-------------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+---------------------+------------+-----------------+----------+----------------+---------+ | Name | Engine...
...show the default character set of a table you have to login to the MySQL console and execute SHOW CREATE TABLE table; mysql> SHOW CREATE TABLE foobar; +---------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Table | Create Table...
To show the MySQL default character set you have to login to the MySQL console and execute SHOW VARIABLES LIKE 'char%'; mysql> SHOW VARIABLES LIKE 'char%'; +--------------------------+----------------------------+ | Variable_name | Value | +--------------------------+----------------------------+
...to uft8 you have to add this default-character-set = utf8 to the client, mysqld_safe, mysqld and mysqldump section (may differ depending on configuration) in your my.cnf and restart...
Look here for informations how you can show the MySQL default character set. At first you need the Amazon RDS Command Line Toolkit download and unzip the Amazon RDS Command...
After that you can create a new parameter group /home/foobar/Downloads/RDSCli-1.4.007/bin/rds-create-db-parameter-group utf8 -f mysql5.1 -d "default parameter with utf8" --aws-credential-file ./aws-credential.txt --region eu-west-1
When searching for text in a MySQL table, you have two choices: The LIKE operator FULLTEXT indexes (which currently only work on MyISAM tables, but will one day work on...
...pain and you will eventually need to deal with it, probably using a non-Mysql solution...
mysql> SELECT @@global.version; +------------------+ | @@global.version | +------------------+ | 5.6.30 | +------------------+ 1 row in set (0,00 sec) MySQL 5.6 Reference Manual says "BLOB and TEXT columns cannot have DEFAULT values". If you want to run...
...and stash you changes in the migration files. 2. Temporally change the sql mode mysql> SELECT @@global.sql_mode; +--------------------------------------------+ | @@global.sql_mode | +--------------------------------------------+ | STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION | +--------------------------------------------+
When using GROUP BY, MySQL now complains if the SELECT includes columns which are not part of the GROUP BY. Reason: There could be multiple values for those columns per...
Also see our card on SQL compatibility modes. Install MySQL 5.6 in parallel, using mysql-sandbox Use MariaDB 10.x What TRADITIONAL changes MySQL 5.7 standard TRADITIONAL
I had a huge MySQL dump that took forever (as in: days) to import, while I actually just wanted to have the full database structure with some data to use...
...on my development machine. After trying several suggestions on how to speed up slow MySQL dump imports (which did not result in any significant improvement), I chose to import just...
This should be fixed in the latest LTS-branches of our mysql2 fork, 0.2.x-lts and 0.3.x-lts. Use gem 'mysql2', git: 'https://github.com/makandra/mysql2', branch: '0.2.x...
...lts' # for Rails 2.x gem 'mysql2', git: 'https://github.com/makandra/mysql2', branch: '0.3.x-lts' # for Rails 3.x in your Gemfile, and do a bundle update mysql2 Background
When talking to your MySQL server via a mysql shell, you can terminate queries by ; or \G -- the latter gives you a vertical output. You know this: mysql> SELECT * FROM...
+----+---------+---------------------+-----------------+ 3 rows in set (0.00 sec) This is how it looks like vertically: mysql> SELECT * FROM users \G *************************** 1. row *************************** id: 1 name: Alice email: alice@example.com greeting: Hello world...
...calculations, e.g. 10 AM CEST minus 8 AM UTC is zero. A datetime in MySQL does not have a zone. It just stores the literal string...
...That means that Rails must make assumptions about timestamps loaded from and written to MySQL. Rails has two completely different modes of dealing with this. We also prefer to use...
...when importing. Dumping safely # Do not do this, since it might screw up encoding mysqldump -uroot -p database > utf8.dump # this is bad Better do: mysqldump -uroot -p database -r utf8.dump
...Note that when your MySQL server is not set to UTF-8 you need to do mysqldump --default-character-set=latin1 (!) to get a correctly encoded dump. In that case...
...you don't need to, but when you want to see which queries your MySQL server currently needs to handle (and if there are locks, etc), you could say SHOW...
...PROCESSLIST in a MySQL shell. Unfortunately, SHOW PROCESSLIST does not allow filtering. When you are on MySQL ≥ 5.1.7, do this instead: SELECT * FROM information_schema.processlist WHERE command != 'Sleep' ORDER BY id...
Directly from the MySql docs: There are three likely causes for this error message. Usually it indicates network connectivity trouble and you should check the condition of your network if...
...replaced file-based methods to ensure only one running instance of a program with MySQL’s GET_LOCK function. The result is mutual exclusivity that works in a distributed environment...
...implementation as a Rubygem seems to be with_advisory_lock. It has support for MySQL, PostgreSQL and SQLite. Unfortunately, it has a horrible caveat in MySQL: With MySQL (at least...
The way MySQL's FULLTEXT tokenizer splits text into word tokens might not always be what you need. E.g. it splits a word at period characters. Since the tokenizer has...
...before it is stored in your FULLTEXT column. E.g. if you don't want MySQL to split at period characters, just strip out period characters. If you apply the same...
...or end of a word: note.title =~ /\bfoo\b/ Unfortunately \b is not available in MySQL. You can use [[:<:]] and [[:>:]] to match the beginning and end of a word instead:
...FROM notes WHERE title REGEXP "[[:<:]]foo[[:>:]]" These markers are unique to MySQL and not available in Ruby regular expressions...
...COUNT(DISTINCT #{field}) AS count") end Although the given variable is sanitized here, the MySQLAdapter's (and probably other adapters as well) method for this is insufficient as it only...
...query will look like this: SELECT COUNT(DISTINCT `id); DELETE FROM users; -- `) AS count; MySQL will complain about a missing column 'id); DELETE FROM users; -- ' which is safe.