How can i change timezone in the Managed MYSQL Database in DigitalOcean? - mysql

I brought new Managed MYSQL Database from DigitalOCean. Now I am unable to change Global timeZone. When I am trying to change it error Occurred and it says there isn't Privileges.
*I'm working with Spring Boot Project.
Is there any solution to resolve that?

Still, there is no way to change it from SQL or digitalocean's dashboard.
there is a way when you create the connection. the main user also hasn't root privileges to change the global variable. so we have one only option. only we can play with the session.
When you create the connection you cant set SESSION timezone.
If you are using Spring boot and Hikari (pool), I'll put the configuration.
Todo this we can use connection-init-sql
spring.datasource.hikari.connection-init-sql=SET SESSION time_zone='Asia/Colombo'
now your session timezone will be as you want.
or you can pass the timezone [serverTimezone] with the connection URL like below,
jdbc:mysql://localhost:3006?serverTimezone=Asia/Colombo

Related

CAS not connected to Mysql for user authentication

I'm new to CAS.
I like to authenticate user to the list of users inside the Mysql database. I have included this line of code in the build.gradle file
implementation "org.apereo.cas:cas-server-support-jdbc:${project.'cas.version'}"
Here is the table defination in Mysql.
I have setup an instance of CAS 6.4 in Ubuntu server, disabled static user authentication and configure the /etc/cas/config/cas.properties to use Mysql as data source for authentication as config below, all other settings leave as default:
server.name=https://id.example.com
server.prefix=${cas.server.name}/
server.context-path=/ server.port=443
server.ssl.key-store=file:/etc/cas/theKeystore
server.ssl.key-store-password=theKeystorePassword
server.ssl.key-password=thePassword
logging.config=file:/etc/cas/config/log4j2.xml
cas.authn.accept.enabled=false
cas.authn.jdbc.query[0].driver-class: com.mysql.jdbc.Driver
cas.authn.jdbc.query[0].field-password: password
cas.authn.jdbc.query[0].password: theDBPassword
cas.authn.jdbc.query[0].sql: SELECT * FROM users WHRE uid=?
cas.authn.jdbc.query[0].url: jdbc:mysql://localhost:3306/cas?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
cas.authn.jdbc.query[0].user: theDBUser
I have set global general_log on Mysql to ON to trace any connection attempt. However, it seems the CAS server never try to connect to the Mysql server. On user site, they simply received attempt failed message on login page.
Is there anything I've missed?
It seems that instead of using
com.mysql.jdbc.Driver
I need to use
com.mysql.cs.jdbc.Driver
as driver-class.

Connection CLOUD-SQL to Google-Data-Studio, what is wrong?

I'm trying to establish a connection between Cloud SQL and Data Studio. I've already tried to make a connection through the MySQL connector with a MySQL db and it failed because I think the Router did not allow the connection.
Then I transferred the db on the cloud but I have the same error!!! Which is:
ID errore: f73c5f49
I already opened Cloud-SQL to all the Data Studio IP addresses, I've created users with "%" and given them all the privileges, I created instance, db and user in CLOUD-SQL (MySQL, 2nd generation).
What else can I try? Could it still be a Router problem?I have to do that for work but it keeps saying that connector parameters are wrong.
PLEASE HELP <3 THANKS A LOT
A common error is to write the instance name instead of the "instance connection name".
You can find the "Instance Connection Name" in the instance page, in the overview section, and normally the format is something like:
[PROJECT_ID]:[region]:[NAME_SQL_INSTANCE]
I also had a similar connection problem with MySql 8.0 but changing to 5.7 fixed it.

How to create a database later with a scala play-framework applicaton?

I have an application written in scala play-framework. I have some credentials in the application config. When a user runs the application, the appliction will create a database for the user. The current configuration is given below.
db.rds.driver=com.mysql.jdbc.Driver
db.rds.host="localhost"
db.rds.port="3306"
db.rds.user = "root"
db.rds.password = "root"
As you can see that there is no db.rds.url or db.rds.dbname. That is because I haven't created a database yet. Later I will create a new database for the user with the users input.
Currently I am getting an error when I run the application. The error says Missing configuration [db.rds.url]
Is it possible? If so then how? I hope I have made myself clear. If you find anything confusing then please ask. Thanks in advance.
According to Play Framework Documentation, when you are using the mysql engine, you should to provide the url configuration in contrast to host and port that you are informing.
If your intent is connect as root into mysql without accessing any specified database, try to supply the following:
db.rds.driver=com.mysql.jdbc.Driver
db.rds.url = "jdbc:mysql://localhost:3306/"
db.rds.user = "root"
db.rds.password = "root"

Cannot connect Delphi App to mySQL database

I have installed a local server Xampp, which is running mySQL database in Windows. I created a Database on it with one table. The thing is I cannot get a connection to the database when I use the dbExpress TSQLConnection component. When I set the properties as follows:
ConnectionName = MYSQLConnection
Driver = MySQL
Database = databaseName
HostName = localhost
password =
UserName = root
When I change the connected property to true, I get the following error:
Borland.Data.TDBXError: DBX Error: Driver could not be properly initialized. Client library may be missing, not installed properly, of the wrong version, or the driver may be missing from the system path
I have tried making a connection to the database using the Data Explorer, but I still get the above error. I do not know what I'm missing or doing wrong.
Im using Delphi-XE2.
with mySQL on the server: MySQL client version: mysqlnd 5.0.7-dev - 091210 - $Revision: 304625 $.
I have also tried using an ADO connection, but I do not know how to set the connection string.
I'm still a noob and just want to learn how to make a connection to a mySQL database running on a web server. I cannot afford to buy any components.
Try this!
Did some google Fu - and stumpled upon this link : http://wiltonsoftware.com/posts/view/getting-embarcadero-dbexpress-mysql-working-dbx-error-driver-not-initialized
That seems to fit your needs.
My previous answer was no help .. hope the new one is better.
Old answer:
Make sure you have Data.DBXMySQL in your uses clause.
OK. I'll try a different approach.
Is it working if you setup the connection in the DataExplorer?
If not - then it's not a problem with the uses clause.
(and you obviously have tried that - sry . must be tired :-))
Otherwise a unit could be like this.
unit Unit1;
interface
uses // <-- Uses normally goes right after interface .... (you probably already have one)
Data.DBXMySql;
implementation
end.

How do I initialize character set settings for a new RDS MySQL instance

I would like to set the following variable for my Amazon RDS server, where do I provide this setting when I create a new RDS instance?
character_set_server=utf8mb4
Note: I want these settings to be permanent and I don't want to modify them every time I re-start the server.
You need to use an RDS DB Parameter Group to do that.
You can create new parameter groups through the aws dashboard but you won't be able to actually change any of the parameters. You'll need to use an API client for that.
As a warning, I don't think RDS yet supports using utf8mb4 in a parameter group. I get an error from the API when I attempt to set character_set_server to that value.