Cannot change server connection collation in phpmyadmin on local WAMP server - mysql

Please help here as I could not change the server connection collation from utfmb4_general_ci to utf_general_ci, it keeps on refreshing back to utfmb4 no matter what I select. If I select utf_unicode_ci, it changed to utfmb4_unicode_ci.
It is quite frustrating.
Thanks,

Since this is your local WAMP server you can first change mysql.ini to change the default character set and collation
[mysqld]
character-set-server=utf8
collation-server=utf8_general_ci
skip-character-set-client-handshake
That will allow you to use the desired charset without sending
'set NAMES'
and
'set CHARSET'
with each connection to DB so it will speed up your application.
I would also suggest that you use the MySQL Workbench instead of phpmyadmin: https://www.mysql.com/products/workbench/ or another tool such as Heidi or Toad for managing your server.

Related

How to set default collation for mysql xampp, windows

Hi I ran into this question and could not get an answer. How can you set default, server-wide collation for your MySQL database for XAMPP+Windows.
What I have figured out. Look for my.ini file in your mysql folder, bin subfoler (e.g. E:\xampp\mysql\bin). Backup your my.ini file and open it for edit, then look for following:
character-set-server=utf8mb4
collation-server=utf8mb4_unicode_ci
Here you can change your collation to the desired default value. Save edits and restart MySQL.

Openshift mySQL character_set_server utf8mb4

I have a Spring web application talking to a mySQL database through hibernate. I am trying to set up utf8mb4 as the database character encoding. I have performed the following steps:
Setup my database using
SET NAMES utf8mb4;
ALTER DATABASE mydb CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci;
Change hibernate url to
hibernate.connection.url = jdbc:mysql://localhost:myport/mydb?character_set_server=utf8mb4
Add SET NAMES 'utf8mb4' to database connection initial SQLs on my Spring application configuration
Added character_set_server=utf8mb4 at my.cnf
I managed to get my application working properly with a local database. Also what I found is that step 2 is not necessary and without step 4 my setup was not working locally.
In Openshift however I have not found a way to perform step 4. Is there any other solution to this problem? I have tried to change character_set_server through phpMyAdmin variables but this is not working either.
There's another MySQL cartridge which can be configured to use utf8mb4. Just backup the data from your database. Remove your MySQL cartridge and add this one:
https://github.com/amgohan/openshift-origin-cartridge-mysql-utf8mb4
And finally restore the backup into your new database.

Change default sql mode

I am trying to set my Mysql mode using this. It works, but when the server is restarted it defaults back to STRICT_TRANS_TABLE, NO_ENGINE_SUBSTITUTION. How can I make it permanent so it stays this way after a restart.
set global sql_mode="NO_BACKSLASH_ESCAPES,STRICT_TRANS_TABLE,
NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
Alter your mysql configuration file. The file is called my.cnf if in windowzzz look for the my.ini
Append the following line to it and restart your mysql engine after
sql-mode="NO_BACKSLASH_ESCAPES,STRICT_TRANS_TABLE,NO_AUTO_CREATE_USER,
NO_ENGINE_SUBSTITUTION"

phpMyAdmin replication

Am trying to set up replication between two servers but keep getting the following error
Full Query says:
SET NAMES 'utf8mb4' COLLATE 'utf8mb4_general_ci';
Both master and slave database have collation set as utf8_general_ci.
Any ideas?
please, check if in the destination server you have that collation and charset available.
You can do it with
SHOW CHARACTER SET
http://dev.mysql.com/doc/refman/5.0/en/show-character-set.html
and
SHOW COLLATION
http://dev.mysql.com/doc/refman/5.0/en/show-collation.html
Thanks for all the help. In the end just uninstalled MySQL and installed an earlier version. They seem to be talking to each other now.

How can I set client configuration for MySQL Workbench without an installed server?

Say I have installed MySQL workbench on windows 7 without a server, and I'm connecting to a remote server.
How can I set client configuration (like the [client] section in 'my.ini') for the workbench?
Or maybe I get it the wrong way and the client loads the configuration from the server that it connects to?
Update:
Maybe I wasn't clear enough. The configuration I'm trying to set is command lines to run at the beginning of each transaction, such as:
SET autocommit=0;
SET tx_isolation='READ-COMMITTED';
If MySQL server is installed on my machine, then I can add the following lines to the 'my.ini' file in the installation folder:
[client]
init-command="SET autocommit=0; SET tx_isolation='READ-COMMITTED'"
You asked this a long time ago, and so maybe this is no longer relevant to you, but I will include a way of doing this here to benefit others.
In Workbench open your connection properties.
On the Connection Tab, select the Advanced Tab.
In there add the following two options to the Others section (obviously change the readDefaultFile location to the location of your my.ini).
readDefaultFile=C:\Program Files\MySQL\MySQL Server 5.7\my.ini
readDefaultGroup=client
Now opening connections should read the client section from that my.ini as required.
MySQL Workbench doesn't load any server configuration file for its own configuration. It can work on such a config file for a server, however (server section, usually [mysqld] only).
MySQL Workbench's configuration is a manual step you have to do in order to connect to a server (be it local or remote).