Doctrine error to create database : Access denied for user - database

i tried to create a new database in Doctrine, with php app/console doctrine:database:create but i got an error : i fixed it thanks to this website
now i've got a second error, but i can't find any solution :
afther this :
pc11:Symfony Paul$ php app/console doctrine:database:create
i've got this error :
Could not create database for connection named symfony
SQLSTATE[28000] [1045] Access denied for user 'root'#'localhost' (using password: NO)
i tried without "symfony" but it did not work :
pc11:~ Paul$ php app/console doctrine:database:create
Could not open input file: app/console
Would you know how to fix this?
Thanks

You're probably missing database configuration, it tries to connect to MySQL as the user root without a password and fails to get the permission to create the database.
Check your parameters.ini for settings related to the database connection.

You need to set the password for root#localhost to be blank. There are two ways:
The MySQL SET PASSWORD command:
SET PASSWORD FOR root#localhost=PASSWORD('');
Using the command-line mysqladmin tool:
mysqladmin -u root -pCURRENTPASSWORD password ''

Solution
This worked for me on Mac OS X with MAMP (or MAMP Pro).
Add database.unix_socket in app/config/parameters.xml
parameters:
database.driver: pdo_mysql
database.host: localhost
database.port: 8888
database.name: my-database-name
database.user: root
database.password: root
database.unix_socket: /Applications/MAMP/tmp/mysql/mysql.sock
Add unix_socket in app/config/config.xml
# Doctrine Configuration
doctrine:
dbal:
# ...
unix_socket: "%database.unix_socket%"

I was having the same problem.
If you want to try with php you have to change app/console to bin/console

Related

Not able to connect to Snowflake database with snowsql

I am not able to connect with snowsql by Windows console:
<!-- language: lang-html -->
C:\Users\musik>snowsql -a [myAccount] -u [myUserName]<br>
Installing version: 1.2.0 [####################################] 100%<br>
Password:<br>
<!-- end snippet -->
I get this error message:
250001 (08001): Failed to connect to DB. Verify the account name is correct: [myAccount].snowflakecomputing.com:443. HTTP 403: Forbidden
If the error message is unclear, enable logging using -o log_level=DEBUG and see the log to find out the cause. Contact support for further help.
Goodbye!
Screenshot
Then I used -o log_level=DEBUG. In the log file I can see that I am getting a "forbidden" error:
2019-12-05 16:45:16,510 (6472/MainThread) snowflake.connector.network DEBUG network:822 - HTTP 403: Forbidden. Retrying...
What can I do? Has somebody the same issue?
From my comment earlier: Be sure to include the region and such in your account. It should include everything up to the snowflakecomputing.com in the URL that you use to access Snowflake through the UI.
Please use below command:
snowflake URL : https://abc.snowflakecomputing.com
Account_name : abc
User_name : Give fully qualified user name
snowsql -a <account_name> -u <user_name>
Note: Prior to this ensure you are able to login with user name and password using snowflake Web UI.

Laravel/Homestead - can't connect to the DB

I have installed homestead on my machine and cloned a project from a remote repository, now I am trying to create a DB for my project.
This is how my .env file looks like:
APP_ENV=local
APP_DEBUG=true
APP_KEY=base64:e7K7SUDgogNqTtP9TO1CfpbXFAC6FmLLSJ1l6K8pbWs=
DB_HOST=localhost
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync
REDIS_HOST=localhost
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
I have tried to connect to DB using sequel pro standard option:
Host: localhost
Password: secret
But I get:
Unable to connect to host 127.0.0.1, or the request timed out.
Be sure that the address is correct and that you have the necessary
privileges, or try increasing the connection timeout (currently 10
seconds).
MySQL said: Can't connect to MySQL server on '127.0.0.1' (61)
What am I doing wrong?
Some options:
Check the service of mysql is running;
Check the user and passowrd are correct;
Check the privilege of the user, try root user
For Mysql Connection you should have check username and password. and .env file
DB_HOST=localhost
DB_DATABASE=Your Database name
DB_USERNAME=username
DB_PASSWORD=password
Along With that, you can update database.php file for database configurations.
I had to add the port 33060 to be able to connect. Hope that will help others who got stuck like me.
I have some problem with Laravel 7 Homestead. I solve the error with this step:
Use mysql port 33060
Clear laraver config. php artisan config:clear
Reload vagrant vagrant reload --provision
And make sure your database name and password is correct.
Happy coding.

No start database manager command was issued. SQLSTATE=57019

I am new to DB2 and I have installed DB2 9.7.
I created an instance which is shown below
[sathish#oc3855733574 ~]$ db2ilist
sathish
Settings of /etc/services is shown below
DB2_sathish 60000/tcp
DB2_sathish_1 60001/tcp
DB2_sathish_2 60002/tcp
DB2_sathish_END 60003/tcp
DB2_TMINST 50000/tcp
But, when I start using 'db2start' it throws the following error
07/31/2015 10:26:20 0 0 SQL1042C An unexpected system error occurred.
SQL1032N No start database manager command was issued. SQLSTATE=57019
I installed DB2 using 'root' and starting 'DB2' from 'instance' (sathish in this case)
Any help or URL link will be of great use
Thanks
Sathish Kumar
I had a look into db2diag.log file and I got a unusual hack from one of the website
I followed the steps mentioned below and it worked
a) db2trc on -f db2trace.out
b) db2start
c) db2trc off
This problem generally occurs if you have recently changed the password of the account which is the owner of that db2 instance what you need to do is go to services-> properties of the db2 instance -> and then from log on part select local system account
This looks like something is wrong with the installation. There should be some hints on what DB2 ran into in the db2diag.log file (look under ~/sqllib/db2dump/db2diag.log).
What you could do if the db2diag.log does not provide a clue is to verify your installation is correct. DB2 includes a tool for that named "db2val". Here is the link to the documentation of db2val for version 9.7. Just run "db2val" as the instance owner and check the output.
Try
sudo -i -u db2inst1 /database/config/db2inst1/sqllib/adm/db2start
For more information
https://dba.stackexchange.com/questions/49807/sql1641n-error-on-linux-while-running-db2start-using-db2-express-c-on-linux-luw

Mysql error when using Cake Bake

H,
I am a newbie to cake php. So there is a problem i'm facing with.
I have installed XAMPP and my cakephp project folder lies in htdocs(/opt/lampp/htdocs/cakephp). When I start cake bake by the command /.cake bake, I am getting a mysql error as below.
enter code here
PHP Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /opt/lampp/htdocs/cakephp/cake/libs/model/datasources/dbo/dbo_mysql.php on line 552
can u help me?
Check if you have MySQL installed properly.
With XAMPP normally get this error.
You can do two things to solve it:
A clean installation of Apache + PHP + MySQL
If you're on a linux or on a mac you can create a symbolic link to the socket:
ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
Where /tmp/ is your XAMPP mysql folder (e.g. /opt/lampp/var/mysql/mysql.sock)

Can't connect to PostgreSQL database with symfony

I'm new to PostgreSQL and this is my first symfony project with PostgreSQL. When I try to run insert-sql in symfony, it tells me my database, salon, doesn't exist. But it does exist, as you can see below.
ason#ve:~/salon$ ./symfony doc:insert-sql
>> doctrine creating tables
PDO Connection Error: SQLSTATE[08006] [7] FATAL: database "SALON" does not exist
jason#ve:~/salon$ sudo -u postgres createdb salon;
createdb: database creation failed: ERROR: database "salon" already exists
It seems that any symfony command I run will tell me that salon doesn't exist (I've tried others). For this reason, my guess is that this is a symfony problem as opposed to a PostgreSQL or PHP problem.
all:
doctrine:
class: sfDoctrineDatabase
param:
dsn: pgsql:host=localhost;dbname=SALON
username: salon
password: foobar123
Any idea what I'm doing wrong?
Boy, do I feel dumb. If I use dbname=salon instead of dbname=SALON, it works.

Resources