I cannot see utf8mb4 characters from my database with cmd on windows - windows

This is how I connect to my database on my Windows cmd: mysql -u mydb -h myip -p.
It has always worked since I tried to swap my utf8 database to utf8mb4. The changes I apply with php or java work fine and I can see those characters correctly when loading from php, java or phpmyadmin but not on my cmd.
I have tried adding --default-character-set=utf8 and --default-character-set=utf8mb4 to the cmd connection with no succeed. It is curious, by the way, that if I run a simple sentence like SELECT '☺'; it shows that character correctly.
Am I missing something?

Based on the findings of danibg in the end of our brainstorming session, he has found this link which describes that this is a MySQL bug which was applicable to 5.5, used by the op and apparently this was fixed for MySQL 5.6+
We tested 5.6 version of client against 5.5 version of server,
especially with respect to non ANSI characters. The 5.6 client worked
as expected and the issue mentioned in this bug was also fixed.
As a result, the solution is as follows:
create a backup and store at least 2 copies
uninstall MySQL 5.5
install MySQL 5.6+
import the copy
do a lot of tests

Related

Can't connect to MariaDB using JDBC, mysql utils succeed

I use JDBC and Spring Boot 2.2.2 to connect to a MariaDB instance. The login fails with this message:
Caused by: java.sql.SQLInvalidAuthorizationSpecException: Could not
connect to
address=(host=server.company.domain)(port=3306)(type=master) : Access
denied for user 'user'#'server.company.domain' (using password:
YES)
When I run mysqldump -u"user" -p"password" -h server.company.domain dbname this works just fine !
Both the dump and the Spring Boot application are run from the same machine (the database server itself)
user and password used are identical
there are no special characters in the password or the user (only lower/uppcase characters and digits)
the jdbc connection string looks like this: jdbc:mariadb://server.company.domain:3306/dbname
I already tried to use localhost instead of the server name
when I change jdbc url, user and password the same application is able log in to my development mariaDB
It seems like you are having trouble with MariaDB, not spring-boot itself.
I suggest you to follow this links: https://mariadb.com/kb/en/configuring-mariadb-for-remote-client-access/, and come back if it didn't solve your problem, with what you tried, and what didn't work.
I ran a short SHOW GRANTS; via the mysql command which is able to connect to the database. The output gave me this:
GRANT ALL PRIVILEGES ON *.* TO 'user'#'%' IDENTIFIED BY PASSWORD 'nonono' REQUIRE SSL WITH GRANT OPTION
The relevant part is REQUIRE SSL: connections to that server need to be done encrypted.
When I checked the files in /etc/my.cnf.d/ I found a file containing (amongst others) these lines:
[server]
ssl=1
ssl-cert=/path/to/certificate/cert.pem
By googling a bit I found this link which describes how to set the JDBC driver to use ssl. It also explains to you why you perhaps should think twice before setting trustServerCertificate to true.
My spring.datasource.url now looks like this:
jdbc:mariadb://server.company.domain:3306/dbname?useSSL=true&trustServerCertificate=true&serverSslCert=/path/to/certificate/cert.pem
To put it short: Access denied for user doesn't tell the complete story. It makes you think that your password might be wrong but you are denied for other reasons.

Moodle 3.3.1 fresh install - Barracuda file format issue

I am new to moodle and trying to install moodle 3.3.1 on my windows system, but after some steps it is showing some errors.
mysql_full_unicode_support#File_format: Your database has tables using Antelope as the file format. Full UTF-8 support in MySQL and MariaDB requires the Barracuda file format. Please convert the tables to the Barracuda file format.
mysql_full_unicode_support#Large_prefix: For full support of UTF-8 both MySQL and MariaDB require you to change your MySQL setting 'innodb_large_prefix' to 'ON'. See the documentation for further details.
site not https: It has been detected that your site is not secured using HTTPS. It is strongly recommended to migrate your site to HTTPS for increased security and improved integration with other systems.
please help me to resolve these errors. i am trying to install moodle on my windows system using xampp server. (localhost)
You seem to be having 3 problems
1. Your DB tables are in an earlier format and needs to be upgraded to Barracuda
Moodle created an easy fix for the first problem, before going ahead with the upgrade, you can run the following script from your server, it will upgrade the problematic tables to the Barracuda format
The following command will give you the list of tables that needs to be updated
$ php /path/to/moodle/admin/cli/mysql_compressed_rows.php --list
Then run the fix
$ php /path/to/moodle/admin/cli/mysql_compressed_rows.php --fix
The following link will give you the steps and guide you through the update, the above scripts are from that link
https://docs.moodle.org/28/en/Administration_via_command_line#Converting_InnoDB_tables_to_Barracuda
2. You are having Unicode problems
As of Moodle 3.2, utf8mb4 is used, some changes are required, these answers have been provided before but here they are just in case.
You will first need to edit your my.cnf file and add the following:
[client]
default-character-set = utf8mb4
[mysqld]
innodb_file_format = Barracuda
innodb_file_per_table = 1
innodb_large_prefix
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
skip-character-set-client-handshake
[mysql]
default-character-set = utf8mb4
Restart your MySQL service and run the following script:
$ php /path/to/moodle/admin/cli/mysql_collation.php --collation=utf8mb4_unicode_ci
Then modify your config.php file:
$CFG->dboptions = array(
…
'dbcollation' => 'utf8mb4_unicode_ci',
…
);
The documentation can be found at the following location:
https://docs.moodle.org/32/en/MySQL_full_unicode_support
3. Your site is not SSL
To make your site SSL you will need to get a SSL certificate from a trusted store such as entrust.
First search result in Google for the error message + "Moodle":
https://docs.moodle.org/33/en/MySQL_full_unicode_support
This answer assumes that you are trying to fix the error on a local installation using xampp.
This is what I did:
first
if you are using xampp on windows, then on your xampp control panel, locate the MYSQL config button and click to see the my.ini option, this is what is called my.cnf on other platforms.
Second
Copy the following text into the my.ini file.
[client]
default-character-set = utf8mb4
[mysqld]
innodb_file_format = Barracuda
innodb_file_per_table = 1
innodb_large_prefix
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
skip-character-set-client-handshake
[mysql]
default-character-set = utf8mb4
Third
restart the MYSQL and the error is gone!

postgres throws the error psql: FATAL: role "username" does not exist

Please, I need help with my postgres server. I have problems starting the server. I was using the app here a few months ago and everything was fine. Today I spent hours trying to start it yet couldn't. I then realised I had another instance of PostgreSQL installed. I uninstalled version 9.6 blocking my app.
Now after trying again, the PostgreSQL app throws the error when I use psql:
FATAL: role "username" does not exist
I didn't set the role or user but it somehow took my username and is throwing does not exist. Please, how do I start my server. I have seen someone with a similar issue here but unlike in his case, I didn't even get to start the server. not to speak of deleting the database. Please, how do I address this? Any help would be appreciated.
I also noticed he was able to execute
which psql
which returned his supposed psql path. It does not return anything in my case. Not sure how the configuration works, this is my second time using this database and it failed right away.
Thank you for your time, as answered in one of the SO question here. Running
sudo -u postgres -i
did give me access to postgres, but if you are using the postgres app like myself here . Running psql commands would not work for you as postgres is not installed globally on your machine. But running
'/Applications/Postgres.app/Contents/Versions/9.5/bin'/psql -p5432
which is the exact command the postgres app execute when you attempt to start the service works great and start the service for me. You can then proceed and add the role and database your postgres app looks for by default. So in summary. Below is what worked for me.
$sudo -u postgres -i
$'/Applications/Postgres.app/Contents/Versions/9.*/bin'/psql -p5432
#CREATE USER postgres SUPERUSER;
#CREATE DATABASE postgres WITH OWNER postgres;

Using ruby-oci8 with AIX successfully (no ORA-12537)

Has anyone successfully used the current (2.1.7) version of ruby-oci8 against Oracle on AIX?
I can run my ruby-oci8 test script and get it to work against TNS for Linux and TNS for Windows but not AIX.
However, it is not an Oracle Instant Client issue, I can do a command line sqlplus connect from my machine to the Oracle (TNS for AIX) server and it works fine. However when I wrap it in a ruby script (using ruby 1.8.7) it fails with:
oci8.c:513:in oci8lib.so: ORA-12537: TNS:connection closed (OCIError)
from /usr/lib64/ruby/gems/1.8/gems/ruby-oci8-2.1.7/lib/oci8/oci8.rb:148:in initialize' from app/controllers/testdb.rb:32:innew'
from app/controllers/testdb.rb:32
I am not doing anything clever here, just creating a new connection like this:
conn = OCI8.new(username, password)
Any information on this would be great, I haven't tried packet sniffing - yet....
-John
I did eventually get this working, the short answer is that I had success using the full connection string, that is:
OCI8.new("user/password#(description=(address=(protocol=tcp)(host=host.uab.edu)(port=1521))(connect_data=(sid=somesid)))")
The confusing part is that this format isn't mentioned in the API and that I had to use sid= of service_name=.
The details are here:
https://github.com/kubo/ruby-oci8/issues/66

OpenLDAP - Named user connection fails

I am trying to setup a basic ldap server/client scenario. I downloaded openldap for windows and installed it. I am starting the server successfully with the command,
slapd -d 1
I tried to use various clients (commandline, LDAP Browser, phpLDAPadmin) to connect and do a search, it works with 'anonymous access' but it fails every time I try the same with root user/password and says 'failed to connect to ldap://localhost:389'. Same thing works if i connect anonymously.
What could be the problem ?
Here's my slapd.conf
ucdata-path ./ucdata
include ./schema/core.schema
pidfile ./run/slapd.pid
argsfile ./run/slapd.args
database bdb
suffix "dc=guessant,dc=org"
rootdn "cn=Manager,dc=guessant,dc=org"
rootpw secret
directory ./data
I am using Login DN as "cn=Manager,dc=guessant,dc=org" and password as "secret"
It has been fixed now .. problem was with PHP mcrypt and phpLdapAdmin. Apparantly there's an issue with PHP 5.2. and figured out that upgrading to 5.3 + or removing mcrypt usage, would fix it. I chose the later, for the timebeing atleast

Resources