I got some strange situation. When i start my spring boot app with application file:
spring:
jpa:
show-sql: true
databasePlatform: org.hibernate.dialect.MySQL5InnoDBDialect
hibernate:
ddl-auto: update
connection:
charSet: UTF-8
characterEncoding: UTF-8
useUnicode: true
datasource:
driverClassName: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/deutschlerner_db?serverTimezone=UTC
username: root
password: root
I recieve the error:
java.sql.SQLException: Access denied for user 'mihailzubarev'#'localhost' (using password: YES)
"mihailzubarev" - is just my linux profile name, mysql doesn't have that username but does have "root" user.
This error i can reproduce just typing in terminal mysql -p it accepts default linux profile username and expectedly drops the same error. But I specified user name in my application file!!!
Futhermore it is possible to connet the database by defining a Bean in SpringBottApplication file and everything works fine
#Bean
public DataSource getDataSource() {
DataSourceBuilder dataSourceBuilder = DataSourceBuilder.create();
dataSourceBuilder.url("jdbc:mysql://localhost:3306/deutschlerner_db?serverTimezone=UTC");
dataSourceBuilder.username("root");
dataSourceBuilder.password("root");
return dataSourceBuilder.build();
}
I got environtment variable which overrided username value
Related
I am trying to create a java spring application with mysql conenction and I am receiving this error :
Access denied for user 'aurelian'#'localhost' (using password: NO)
Mind you that I have user/password and in my application properties, I have my server on, and the password it is correct:
`######## Database Properties #######
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/spring_reddit_clone
spring.datasource.username=aurelian
spring.datasourxce.password=XXXXXXXXXXXXXX
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
spring.jpa.hibernate.ddl-auto=update
spring.datasource.initialize=true
spring.jpa.show-sql=true**strong text**`
Also I am using mysql-connector-java-8.0.25.jar so I do not have any ideeas.
Best Regards,
Aurelian
Typo alert.
Change datasourxce to datasource
spring.datasource.password=XXXXXXXXXXXXXX
I need to create MYSQL connection through ODI with JDBC connection but I need some help for do this. according to ODI topology I have to fill this JDBC URL with my info:
jdbc:mysql://<host>[:<port>]/[<database>]?relaxAutoCommit=true[&<property>=<value>...]
my DB info is:
ip address: 10.5.6.77
port:3304
username: root
password: rewcvt4567
database name: accdb
my os info is:
ip address: 10.5.6.77
port:22
username: root
password: dfrtvb6784
I should say, SSh tunnel has been enabled on my server.
All you have to do us just fill this with host, port and service name
jdbc:mysql://[:]/[]
in your case it will be
jdbc:mysql://10.5.6.77:3304/accdb
in definition connection fill it with
username: root
password: rewcvt4567
I am having mysql in my local application and our client has given a sample application db access where we can find more seed data.
Now my question is there anyway of accessing the client data by changing any database.yml file in my local?
I tried using workbench -> Data export, I am getting the following error:
mysqldump: Got error: 1045:Access denied for user 'un'#ip-address (using
password: no) when trying to connect
Operation failed with exitcode 2
Is there any way to access the remote data without exporting?
you have to provide the ip address as host and all the login credentials to access it, also make sure you are inputting correct values. First check your connection by testing it on workbench then put values in yml file.
default: &default
adapter: mysql2
pool: 5
timeout: 5000
port: 3306
development:
<<: *default
database: <database name>
host: <ip address>
username: <username>
password: <password>
socket: <socket> or /tmp/mysql.sock
I created a new Symfony 4 project and want to create a new database. I'm following this tutorial but can't get it to work. When running
php bin/console doctrine:database:create
I always get the same error:
In AbstractMySQLDriver.php line 112:
An exception occurred in driver: SQLSTATE[HY000] [1045] Access denied for user 'user_1'#'localhost' (using password: YES)
In PDOConnection.php line 50:
SQLSTATE[HY000] [1045] Access denied for user 'user_1'#'localhost' (using password: YES)
In PDOConnection.php line 46:
SQLSTATE[HY000] [1045] Access denied for user 'user_1'#'localhost' (using password: YES)
Following the tutorial, I configured database url in .env file, but it doesn't seem to change anything.
DATABASE_URL=mysql://user_1:secretPassword#127.0.0.1:3306/db_name
My config/packages/doctrine.yaml configuration:
parameters:
env(DATABASE_URL): ''
doctrine:
dbal:
# configure these for your database server
driver: 'pdo_mysql'
server_version: '5.7'
charset: utf8mb4
default_table_options:
charset: utf8mb4
collate: utf8mb4_unicode_ci
url: '%env(resolve:DATABASE_URL)%'
orm:
auto_generate_proxy_classes: '%kernel.debug%'
naming_strategy: doctrine.orm.naming_strategy.underscore
auto_mapping: true
mappings:
App:
is_bundle: false
type: annotation
dir: '%kernel.project_dir%/src/Entity'
prefix: 'App\Entity'
alias: App
Tried everything and nothing seems to work. Any help would be greatly appreciated.
Possibly, your user has no permissions to CREATE DATABASE operation.
Grant privileges to your user with grant CREATE on *.* to 'user_1'#'localhost'; in MySQL console.
refer to this similar issue
Possible reasons of the issue :
collation of your database
mysql credentials are invalid
Check connection with current credentials.
Example for *nix
mysql -uuser_1 -p
When check mysql server's port
mysql> SHOW GLOBAL VARIABLES LIKE 'PORT';
Try to replace localhost for 127.0.0.1 in your .env(or other .env.*) file.
I have a problem using the heroku db:push command to transfer a MySQL database to heroku. I've tried using the same command for another app with a sqlite3 database and everything went fine.
C:\Users\reg\Team-Omni>heroku db:push
Loaded Taps v0.3.9
Auto-detected local database: mysql://127.0.0.1/omni_dev?encoding=utf8
Warning: Data in the app 'growing-mist-42' will be overwritten and will not be recoverable
.
Are you sure you wish to continue? (y/n)? y
Failed to connect to database:
Sequel::DatabaseConnectionError -> Mysql::Error: Access denied for user 'reg'#'localhost
' (using password: NO)
if i remove the password for the mysql anonymous account, the error changes to
Sequel::DatabaseConnectionError -> Mysql::Error: Access denied for user ''#'localhost' to database 'omni_dev'
--additional information--
my .gems file:
rails -v 2.3.8
andre-geokit --version 1.5.0 --source http://gems.github.com
You are getting that error because you are not specifying the password for the local database connection. Apparently the username is configured as 'reg' (maybe in the MySQL config file). This doesn't have anything to do with the Heroku PostgreSQL database, it's a problem connecting to your local MySQL database (named omni_dev).
Try the following connection string:
mysql://USERNAME:PASSWORD#127.0.0.1/omni_dev?encoding=utf8
for the appropriate values of USERNAME and PASSWORD.
I've had this problem as well, but I was passing a password. My local app worked fine, but when using heroku db:push, I got the same error as redge.
Adding a port in the database.yml fixed the problem. So, a working database.yml has the following entries:
database: DATABASE
username: USER
password: PASSWORD
adapter: mysql
encoding: utf8
socket: /Applications/MAMP/tmp/mysql/mysql.sock
port: 8889