Virtual Machines are great, and very useful when trying out new software. However, they might be an unnecessarily heavyweight solution when testing clusters, especially if these consist of multiple nodes running exactly the same software. Each VM runs a full-blown OS image.
Showing posts with label Mysql. Show all posts
Showing posts with label Mysql. Show all posts
Saturday, December 16, 2017
How to Deploy Galera Cluster for MySQL using Docker Containers
Virtual Machines are great, and very useful when trying out new software. However, they might be an unnecessarily heavyweight solution when testing clusters, especially if these consist of multiple nodes running exactly the same software. Each VM runs a full-blown OS image.
Monday, September 11, 2017
Friday, July 28, 2017
7 ways to convince MySQL to use the right index
Sometimes MySQL gets it wrong. It doesn't use the right index. It happens that MySQL generates a query plan which is really bad (EXPLAIN says it's going to explore some 10,000,000 rows), when another plan (soon to show how was generated) says: "Sure, I can do that with 100 rows using a key".
Monday, December 30, 2013
How to make UTF8 work with Ruby 1.9/2.0, Rails and Mysql
Storing and presenting UTF8 was always a problem especially when each component in your web development stack has partial support for UTF8.
The data entered in the forms on the web pages are valid utf8, and Mysql databases were encoded with
With Ruby 1.9/2.0 and Mysql2 gem, something went wrong and the data no longer displayed correctly. I found that the best solution to fix this problem is by configuring Mysql correctly and reinserting the data in the correct encoding.
1) First, backup your database.
2) Add the following configurations in Mysql my.cnf file, do not add [client] and [mysqld] just add the options in their respective directives;
[client]
default-character-set = utf8
[mysqld]
character-set-server=utf8
collation-server=utf8_general_ci
mysqldump -u root -p --opt --default-character-set=latin1 --skip-set-charset DATABASE_NAME > DATABASE_NAME.sql
mysql -u root -p --default-character-set=utf8 DATABASE_NAME < DATABASE_NAME.sql
Don't forget to check your data thoroughly to make sure that all characters are displayed correctly.
The data entered in the forms on the web pages are valid utf8, and Mysql databases were encoded with
utf8, but the Rails app with the original mysql gem (version 1) was storing data in latin1 encoding into the utf8 tables! Somehow the data retrieved from Mysql was displayed properly in utf8 if I take care to remove encoding :utf8 from mysql gem database configuration, and set the html character set to utf8.With Ruby 1.9/2.0 and Mysql2 gem, something went wrong and the data no longer displayed correctly. I found that the best solution to fix this problem is by configuring Mysql correctly and reinserting the data in the correct encoding.
1) First, backup your database.
2) Add the following configurations in Mysql my.cnf file, do not add [client] and [mysqld] just add the options in their respective directives;
[client]
default-character-set = utf8
[mysqld]
character-set-server=utf8
collation-server=utf8_general_ci
3) Dump the database but prevent Mysql from converting the encoding of the data.mysqldump -u root -p --opt --default-character-set=latin1 --skip-set-charset DATABASE_NAME > DATABASE_NAME.sql
mysql -u root -p --default-character-set=utf8 DATABASE_NAME < DATABASE_NAME.sql
Don't forget to check your data thoroughly to make sure that all characters are displayed correctly.
Subscribe to:
Posts (Atom)
bundlephobia
JavaScript bloat is a more real problem today than it ever was. Bundlephobia lets you understand the performance cost of adding a npm pack...
-
Programmers almost always need the ability to find and replace certain text across multiple files in their projects. Most IDEs provide find ...
-
This is yet another rails stack installation how to. It is useful for installing a production rails hosting environment using Nginx as the ...
-
Git is a Version Control System , it is used to keep a history of all the changes you made into your code, manage releases, makes it easier...