NAME W STATUS CHECK ACT BCK QCUR QMAX SCUR SMAX SLIM STOT >>> mysql-front FRONTEND 0 OPEN 0 0 0 0 0 0 75 0 >>> mysql-back...
...hatop and pressing F10. Via socat it works this way: # disable server / echo "disable server mysql-back/mysql1" | socat unix-connect:/var/run/haproxy/haproxy.stat stdio Now no new connections will be opened...
When MySQL refuses to use your index, there's a number of things that you may be doing wrong. One of them might be conditions with improper data types.
...assume you have a users table with an email field (varchar) which is indexed. MySQL will use the index when your query is well-formed: mysql> EXPLAIN SELECT * FROM users...
We had a card that described how to install multiple mysql versions using mysql-sandbox. Nowadays with the wide adoption of docker it might be easier to use a MySQL...
...docker image for this purpose. Create a new mysql instance docker run --name projectname_db -e MYSQL_ROOT_PASSWORD=secret -p "33008:3306" -d --restart unless-stopped mysql:5.7
When selecting records in a date range, take care not to do it like this: start_date = Date.parse('2007-05...
...good news is that with statement_timeout for PostgreSQL and max_execution_time for MySQL (5.7.8 or higher) both databases offer a variable to limit the execution time of queries...
...set the statement globally for your PostgreSQL cluster or for a specific database user. MySQL (5.7.8 or higher) Timeout Type: max_execution_time Scope: Applies only to SELECT statements; other...
So you're switching to PostgreSQL from MySQL? Here is some help... General hints on PostgreSQL \? opens the command overview \d lists things: \du lists users, \dt lists tables etc...
...Command comparison Description MySQL command PostgreSQL equivalent Connect to the database mysql -u $USERNAME -p sudo -u postgres psql Show databases SHOW DATABASES; \l[ist] Use/Connect to a database named...
...databases are actually very complicated, and chances are, your making some incorrect assumptions. The MySQL innodb engine actually has four different modes for transactions: READ UNCOMMITTED READ COMMITTED REPEATABLE READ...
...are consistent nonlocking reads. The problem with consistent nonlocking reads If you open a MySQL transaction, the first SELECT statement will establish a "snapshot" of the database's state. All...
Note: For PostgreSQL you should use advisory locks. For MySQL we still recommend the solution in this card. If you need to synchronize multiple rails processes, you need some shared...
...can be used as a mutex. One option is to simply use your existing (MySQL) database. The attached code provides a database-based model level mutex for MySQL. You use...
...of does not consider "username" and "USERNAME" to be a collision. If you use MySQL this will lead to issues, since string comparisons are case-insensitive in MySQL.
...sensitive: false end When you get an ActiveRecord::RecordNotUnique error (probably in combination with Mysql2::Error: Duplicate entry) for a string field, case sensitivity may be your issue...
Caution when using .where to exclude records from a scope like this: # Fragile - avoid User.where("id NOT IN (?)", excluded_ids...
validates_uniqueness_of is not sufficient to ensure the uniqueness of a value. The reason for this is that in...
...works differently See PostgreSQL: Difference between text and varchar columns for PostgreSQL-specific info MySQL has 4 different column sizes. They are actually different data types under the hood:
...want to see how long your database queries actually take, you need to disable MySQL's query cache. This can be done globally by logging into a database console, run...
ActiveRecord::Base.uncached do yield end true end Don't forget to re-enable MySQL query caching later with SET GLOBAL query_cache_type=ON...
The Oracle mysql client has an odd behavior if your server uses latin1 as default character-set-server. Command mysql --version mysql Ver 8.0.31-0ubuntu0.20.04.2 for Linux on x86...
mysql --default-character-set utf8mb4 -e "SHOW VARIABLES LIKE '%char%';" Expectation utf8mb4 will be used as character set in this session. Reality The mysql client falls back to latin1...
Create a user without password (recommended) Replace newuser with your desired username: mysql -uroot -p CREATE USER 'newuser'@'localhost' IDENTIFIED BY ''; GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'localhost'; FLUSH PRIVILEGES...
...by a password, you can remove the password. Replace existinguser with your desired username: mysql -uroot -p SET PASSWORD FOR existinguser@localhost=''; FLUSH PRIVILEGES; exit; Create a user with unix...
Like in any language, a FLOAT has complicated semantics for precision. This sometimes causes stored numbers to be slightly off...
CONCAT('foo', 'bar', NULL) = NULL the NULL always wins in MySQL. If you would rather treat NULL as an empty string, use CONCAT_WS (concatenation with separator) instead...
In MySQL comparing zero to a string 0 = "any string" is always true! So when you want to compare a string with a value of an integer column, you have...
...knowing a secret token: Potential Query Manipulation with Common Rails Practises CVE-2013-3211 MySQL madness and Rails
This article describes how to reset MySQL's or MariaDB's root password on your workstation. It's meant for local development purposes only, don't do this in production...
...you prefer using a password for root. Solution Step 1 is getting a root mysql shell that allows us to change user credentials. We need to stop the mysql daemon...
For string columns, MySQL indexes the left side of a string. That means an index can speed a like query that has a wildcard on the right side:
Ubuntu has a package mysql-sandbox that lets you install multiple MySQL versions into your user home: Install mysql-sandbox sudo apt install mysql-sandbox Download the version of MySQL...
...you want to use from mysql.com: https://dev.mysql.com/downloads/file/?id=480427 Make sure to choose "Generic Linux" instead of "Ubuntu" so you get a .tar.gz instead of .deb cd into the directory...
...public | pages | 3919 Please note that this does not work reliably on database slaves. MySQL SELECT table_name, table_rows FROM information_schema.tables WHERE table_schema = (SELECT database()) ORDER BY table...
...in different order. Solving deadlocks is potentially complicated, so here are a few pointers: MySQL should always detect the deadlock right when it happens, and will throw an error to...
...still cannot see what actually happened, you might need to get better acquainted with MySQLs locking model. While it keeps out of your way usually, it's actually pretty complex...
...lives in another table, you need to JOIN both tables during the UPDATE. In MySQL you can do it like this: UPDATE employees LEFT JOIN departments ON employees.department_id = departments.id...