When I make a query from the mysql console and it has accents or any character that needs to be utf-8 encoded, it gets mugged
INSERT INTO users (userName) VALUES ("José Alarcón");
SELECT userName FROM users;
José Alarcón
SET NAMES utF8 changes nothing --default-character-set=utf8 as parameter changes nothing
Keep in mind than this is ONLY from the console. If I use phpmyadmin or make any query from a program, there is no problem at all, but an inserted row from the console gets muggled.
I'm using putty on windows as client
~$ locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
Clarification:
Mi local computer is windows XP, i'm using putty 0.60 as terminal client. The target system where MySQL is running is a Debian linux
I can't find any configuration in putty for character encoding...
Update: Stupid PuTTY, having the encoding configuration inside a menu called "translation" WTF?
Set PuTTY to interpret received data as UTF8 in Window -> Translation "Character set on received data".
Windows can't handle UTF8 in console and system messages (which putty uses). It wants to use your locale codepage. This is a common and known problem, and it's not solvable without rewriting cmd.exe, or using a different command line tool.
Microsoft have never really bothered about encodings outside their own world, which results in weird windows specific codesets.
Maybe you can change the putty encoding somewhere in its options so that it can at least communicate correctly to the mysql cli?
Your terminal client must be configured using UTF8. Your shell environment on the server must also be configured as UTF8. You can check it out with the following command.
locale
It depends on the distribution (I'm assuming you are using linux) how the system prefers how you fix the locale information if needed. For instance, Debian (and, I guess, Ubuntu) ask you to use the following command to reconfigure the locale settings.
dpkg-reconfigure locales
Notice; I'm not sure if they've changed this, haven't tested it in a while. :-)
You can of course set the locales in the shell each time you log in or in your profile. I recommend that you use the distribution's method to do it (if you need to do it after all :-)).
Related
MySQL 8.0 Command Line Client crashes right after entering the correct password. I have also checked in services and there is no problem there. I'm using windows
This might be because MYSQL service is stopped.
Open search bar in windows and type services
Open the services application and find MYSQL application.
Click on start
Now open sql command line and try entering password
It is because MySQL Server stop, may be you run another application that use the same port. Try to run MySQL Installer Community, and you will find the program that you have to reconfigure (blue text). Try to configure MySQL Server ant click Test Connection.
It's hard to tell with no debug output or error codes, but disabling ssl might do the trick:
mysql --ssl-mode=DISABLED --host=$MYSQL_HOST --user=$MYSQL_USER ....
I had the same issue, was looking through Google to find an answer and came here. Are you sure, that you provided MySQL password? The root cause of my problem was the fact, that I put the MySQL user instead of MySQL password (the root one). Now everything is working fine.
That could mean that the password is failing. Check CapsLock key.
Go to Control Panel and uninstall MySQL Server only, you don't need to unstall the other MySQL files.
As mentioned here, make sure you can see hidden folders and then delete the following folders:
C:\Program Files\MySQL
C:\Program Files (x86)\MySQL
C:\ProgramData\MySQL
C:\Users<your-username>\AppData\Roaming\MySQL
Reinstall MySQL Server Package only
Select another password (looks like the current password is the problem)
Come here and vote me up :)
Do something nice for someone else ;)
I'm writing a new project that utilises MySQL , There is no problem with the app I'm working on, but when the app recives the output from my sql server it immediately rejects it as null. When accessing my SQL server on port 3306 I am getting strange garbled messages back as well as the short message 'packets out of order.' In my setup I have, MAMP, Docker, Apache server and PHP. I can access each service on its respective port just fine.
1) I have looked into this by running console in the browser which reports the text being incorrectly formatted to something that isn't utf-8
2) I have followed this guide
https://medium.com/#manish_demblani/breaking-out-from-the-mysql-character-set-hell-24c6a306e1e5 and the results that my sql server have churned out are as follows
enter image description here
My question is this. Why is MySQL set up in this strange fashion? Why is it presenting in CP850 /DOS/ Latin? Are there no defaults/config files to change or is it done through windows somewhere
It seems you somehow messed up the client configuration (connection string, [client]-section of your cnf file (on the system that you started the mysql console on), ...). It tells your server to send data in cp850. Not sure why you would get packets out of order, maybe you have an additional underlying problem (very old library maybe?), but I'd start there. It's unclear: did you follow the blog post and then had problems, or was that a solution attempt? In any case, try to focus your attention on the client. Try to undo changes you made. MySQL uses utf8 by default for a long time now. – Solarflare
I'm seeking for solution to pass the password securely to MySQL client on *nix platforms while using automated script solution (i.e Bash script).
So far, I had to realize that MySQL ignores password input from stdin at all (still asks for password on terminal, crashes on automation).
The worst, solution using ~/.mylogin.cnf also doesn't work for me, it seems MySQL somehow ignores it at all.
I prefer to not to use the command line -p argument for password to prevent described "all-around" security issues.
--defaults-file and --defaults-extra-file handn't give the solution as well, seems like the password is prompted by client at "all-cost".
Therefore, I'm just running out of solutions for that primitive (at first sight) task!
Any help will be highly appreciated!
I'll try to be short in my findings:
First, the solution using mysql --defaults-extra-file="path/to/file" is actually worked for me among with --default-file option until it is passed as the first argument (as well noticed by Bill Karwin here).
Second, usage of ~/mylogin.cnf also workes fine until the file access restricted for all users except the current account the MySQL client is running under + file is restricted from execution even by current user (chmod u-x) as well, possibly treated by MySQL as a threat due to Linux GUI x permission umbrella on many systems (execute permission is enabled for user, group and others by setting one V in GUI for the file). Still this reason is just a suggestion.
I am trying to debug something larger and I noticed that I can not properly connect to mysql from cygwin. I run the command by providing the host, user and password, and the only output is the error:
Warning: Using a password on the command line interface can be insecure.
after which it just idles.
interesting is that when i run
which mysql and I go to that path with the command prompt from windows and run the same command everything is ok.
Some console applications that weren't compiled using Cygwin may work incorrectly inside Cygwin's terminal. MySQL client is probably one of them. To use MySQL client with Cygwin, I'd install one from official Cygwin's repositories rather than trying to use native Windows MySQL. (Note that this doesn't mean installing whole server, just the client.)
I have used mysql-workbench on both Windows and Linux (Ubuntu) for a while now, and I find it's interface very comfortable, so when I needed a good GUI MySQL client to integrate with my code this was the obvious choice.
My MySQL connections parameters are saved in my server (IP, user, password) and I want to use these paremeters to open a mysql-workbench query window.
I read the command line arguments help (I use version 6.0) and it seems I can open a specific connection by it's name, but I want the code to be independent of my saved connections as I trust the connection info from my server more than one saved in mysql-workbench.
Is there an option to connect to an "anonymous" connection, or to create/manipulate connections from the shell (in either Windows or Linux)?
No, there's no such feature. Always use the connection name. If you want you can create a feature request at http://bugs.mysql.com to get attention for your wish.