Posted 6 months ago by Daniel Straßner.

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

Posted over 5 years ago by Tobias Kraze.

...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...

Posted over 8 years ago by Henning Koch.

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...

Posted about 9 years ago by Thomas Eisenbarth.

If you get a stacktrace complaining about uninitialized constant MysqlCompat::MysqlRes a system library update might broke your gem. You might have switched from MySQL to MariaDB, but forgot to...

...rebuild your MySQL gems. Try fully removing and re-installing the gem: gem uninstall mysql mysql2 bundle install

Posted over 1 year ago by Tobias Kraze.

On some of our older projects, we use the mysql2 gem. Unfortunately, versions 0.2.x (required for Rails 2.3) and versions 0.3.x (required for Rails 3.2) can no longer...

...when compiling the native extension, or a segfaults when using it. For Rails 4.2, mysql2 version 0.4.10 seems to work okay. If you still have issues, upgrade to 0.5.x...

Posted over 8 years ago by Andreas Robecke.

I recently experienced the error ActiveRecord::StatementInvalid: Mysql2::Error: closed MySQL connection. Apparently this happens when there is a timeout during query execution. In order to fix this you can...

All TEMPORARY tables are closed (and dropped). ... For further details see the mysql doc. You can actually force this error by setting a short timeout and sleeping in...

Posted almost 4 years ago by Henning Koch.

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...

Posted over 9 years ago by Florian Heinle.

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...

Posted over 11 years ago by Arne Hartherz.

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...

Posted almost 4 years ago by Henning Koch.

...with both old and new Rails applications. Switch to MariaDB Remove MySQL: sudo apt remove mysql-common mysql-client mysql-server mysql-apt-config Install MariaDB: sudo apt install mariadb...

The mysql and mysql2 gems installed on your machine are still built against the mysql-client package you just uninstalled, so you will probably get this error when booting...

Posted over 10 years ago by Kim Jahn.

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...

Posted over 9 years ago by Martin Straub.

shell-for stage_1 shell-for stage_2 Get the stage1 and stage2 MySQL credentials: cat /opt/www/the_stage.host.tld/current/config/database.yml cat config/database.yml # should do it Dump the table to a path reachable...

...by the stage2 user (e.g. home): mysqldump -h mysql1 -u stage_1_user -p stage_1_database table_name > ~/table_name_dump.mysql # Select certain records using --where "some_id > 666"

Posted over 9 years ago by Tobias Kraze.

If you upgrade to the mysql2 gem, you will run into the problem that the server's database.yml (which is usually not under version control) needs to change exactly on...

You can however make your database.yml work for mysql and mysql2 at the same time. Simpy do this production: adapter: <%= defined?(Mysql2) ? 'mysql2' : 'mysql...

Posted over 4 years ago by Natalie Zeumann.

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

Posted over 11 years ago by Martin Straub.

Unless all MySQL server defaults are set to UTF-8, mysqldump encodes UTF-8 characters incorrectly and only outputs correct UTF-8 when you switch to Latin 1 (!). Also you...

...for each new database. To prevent this, make sure your /etc/mysql/my.cnf looks like this: [mysqld] default-character-set = utf8mb4 collation-server = utf8mb4_unicode_ci [mysql] default-character-set=utf8mb4

Posted almost 4 years ago by Florian Heinle.

...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...

Posted over 11 years ago by Henning Koch.

...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...

Posted over 9 years ago by Henning Koch.

So you got this error, even though your Gemfile bundles mysql2: !!! Missing the mysql2 gem. Add it to your Gemfile: gem 'mysql2' or Please install the mysql adapter: `gem install...

...activerecord-mysql-adapter` (mysql is not part of the bundle. Add it to Gemfile.) The reason for this confusing error message is probably that your Gemfile says mysql2, but your...

This website uses short-lived cookies to improve usability.
Accept or learn more