Install MySQL with ansible on ubuntu

When mysql-server is installed headlessly, there’s no password. Therefore to make .my.cnf work, it should have a blank password line. Here’s what I tested with for a .my.cnf: [client] user=root password= It’s also slightly strange to put .my.cnf in your vagrant user directory as owned by root and only readable as root. After ensuring the … Read more

MySQL Cross Server Select Query

how about using federated tables on one of the servers? create the federated tables based on the remote tables you will use in the query and just run your query as if your database was all local. example below from MySQL site The procedure for using FEDERATED tables is very simple. Normally, you have two … Read more

MySQL Workbench – How to clone a database on the same server with different name?

You can use migration wizard from MySQL Workbench. Just choose the same local connection in both source and target selection, then change schema name on manual editing step. If nothing appears on manual editing step click next and the source and targets will appear. Click slowly on the source database name and edit to the … Read more

Renaming Columns in an SQL SELECT Statement

You can alias the column names one by one, like so SELECT col1 as `MyNameForCol1`, col2 as `MyNameForCol2` FROM `foobar` Edit You can access INFORMATION_SCHEMA.COLUMNS directly to mangle a new alias like so. However, how you fit this into a query is beyond my MySql skills 🙁 select CONCAT(‘Foobar_’, COLUMN_NAME) from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME = … Read more

Search a whole table in mySQL for a string

Try something like this: SELECT * FROM clients WHERE CONCAT(field1, ”, field2, ”, fieldn) LIKE “%Mary%” You may want to see SQL docs for additional information on string operators and regular expressions. Edit: There may be some issues with NULL fields, so just in case you may want to use IFNULL(field_i, ”) instead of just … Read more

getting Lost connection to mysql when using mysqldump even with max_allowed_packet parameter

Try adding the –quick option to your mysqldump command; it works better with large tables. It streams the rows from the resultset to the output rather than slurping the whole table, then writing it out. mysqldump -uroot -h my.host -p’mypassword’ –quick –max_allowed_packet=512M db_name table_name | \ gzip > dump_test.sql.gz You can also try adding the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)