i want just to host a website previously work , into another web server
i have change parameters.yml file with new host parameteres of connection
i have upload all my files , and i have import my databases
when i try to enter (myhost/web ) i have this errors : Access denied for user 'root'#'localhost' (using password: NO)
error.log
[07-Dec-2022 15:30:13 Africa/Algiers] PHP Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[28000] [1045] Access denied for user 'root'#'localhost' (using password: NO)' in /home2/icares/logicom.dz/ncomparer/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:43
Stack trace:
#0 /home2/icares/logicom.dz/ncomparer/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php(43): PDO->__construct('mysql:host=127....', 'root', NULL, Array)
#1 /home2/icares/logicom.dz/ncomparer/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOMySql/Driver.php(45): Doctrine\DBAL\Driver\PDOConnection->__construct('mysql:host=127....', 'root', NULL, Array)
#2 /home2/icares/logicom.dz/ncomparer/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(360): Doctrine\DBAL\Driver\PDOMySql\Driver->connect(Array, 'root', NULL, Array)
#3 /home2/icares/logicom.dz/ncomparer/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(429): Doctrine\DBAL\Connection->connect()
#4 /home2/icares/logicom.dz/ncomparer/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(389): in /home2/icares/logicom.dz/ncomparer/app/cache/prod/classes.php on line 3390
I have change the parameters of connection with new server , but the error is that username root password no and server is localhost , what i must do ?
The error.log says that your Symfony trying to access database (probably MySQL) via the user 'root' from a local host. But your database, MySQL is not set to allow access as 'root'.
MySQL and most databases do not allow to access as 'root' as default as security reason, especially without password (what your erro said).
So, may be you need to check:
What is your database_user and database_password set in Symfony project (parameters.yml?)
Check MySQL from cli that what kind of previleges are set for your database.
The way to access mysql without password may find here:
Allow linux root user mysql root access without password
Or some hints may be here:
How to create a root user with no password in mysql
Related
I am trying to connect an application named thingsboard with a postgresql DB both running on Google Cloud Engine.
I have the following files provided by GCE when I set up the DB as allow only SSL connections:
client-cert.pem client-key.pem server-ca.pem
This is where the connection to the DB is set up. I tried with a the client-key.pem as client-key.pem, client-key.key, client-key.pk8 (with and without passphrase, when added passphrase I added the field "sslpassword=MYKEY"
url: "${SPRING_DATASOURCE_URL:jdbc:postgresql://DATABASEIP:5432/thingsboard?sslmode=verify-ca&sslrootcert=/etc/thingsboard/conf/keystore/server-ca.pem&sslcert=/etc/thingsboard/conf/keystore/client-cert.pem&sslkey=/etc/thingsboard/conf/keystore/client-key.pk8}"
username: "${SPRING_DATASOURCE_USERNAME:MYDBUSERNAME}"
password: "${SPRING_DATASOURCE_PASSWORD:MYDBPASSWORD}"
I am getting the following error
2019-01-16 18:55:32,866 [localhost-startStop-1] ERROR o.a.tomcat.jdbc.pool.ConnectionPool - Unable to create initial connections of pool.
org.postgresql.util.PSQLException: Could not read SSL key file /etc/thingsboard/conf/keystore/client-key.pk8.
I'm still learning how to work with a databases using python libraries
An operational error has occurred while executing the following code
screenshot
Code snippet:
import pymysql
db1=pymysql.connect(host="127.0.0.1",user="root",password='root',port=3306,db='world')
a=db1.cursor()
sql='SELECT * from CITY'
print(a.execute(sql))
Error:
(1045, "Access denied for user 'root'#'localhost' (using password: NO)")
what could be the reason for this?
An operational error has occurred while executing the following code screenshot. what could be the reason for this?
Error in question is:
(1045, "Access denied for user 'root'#'localhost' (using password: NO)")
It reveals that you are attempting to connect without password while you actually supplied one in connection arguments. This was at one point known bug with pymysql so answer can be version dependent. If you can normally connect to mysql with mysql -u root -proot world (database, password and user from your connect arguments) that means that your database is indeed with proper credentials and expects password while connect method is not sending one, most probably due to old version. On the other hand if you can't connect then most probably your root password is blank and you need to set it properly. Also there is option that you have issues with access to database 'world' for root user.
I have a rails 4.2 application with postgres database which is running. I have requirement to connect with other databases (word_press_sites) on demand basis.
I have tried the below code this into rails console:
ActiveRecord::Base.establish_connection(
adapter: "mysql2",
host: ENV["HOST"],
username: ENV["USERNAME"],
password: ENV["PASSWORD"],
database: ENV["DB_NAME"]
)
above code results,
No error, connected to the word_press database_tables.
1) If am trying to access the table by calling User.all in my rails application db i can not able to access which is throwing an error.
After opening the rails console you can check
ActiveRecord::Base.connection.current_database
This will give the current db info,Then try the script you have given
ActiveRecord::Base.establish_connection(
adapter: "mysql2",
host: ENV["HOST"],
username: ENV["USERNAME"],
password: ENV["PASSWORD"],
database: ENV["DB_NAME"]
)
Now try the same command
ActiveRecord::Base.connection.current_database
This will give the newly connected ActiveRecord connection
Which means Active record is shifted into newly connected wordpress database so that you can not able to access the table in your rails application database
If you want to revert back to your rails app db you can do this
ActiveRecord::Base.remove_connection( ActiveRecord::Base)
Let me know if you need more information
I have set up xampp server where I am developing a laravel app:
Every day (when I make an update to my app) I have to export and import the SQL from the database. That takes a lot of time if I have worked on 10 apps that day :(
Is there a way I can use the online database with a local test version of laravel?
I am using shared hosting and not migrations. I insert tables myself.
Online I see a tab:
access hosts: 'localhost'
I can add a host, but what name should I add and how can I get laravel to access this host?
Could it be 'subdomain.mywebsitename.nl/hostname'?
I'm too scared my app will crash if I change it :s
This i tried this after the solution i got:
I filled in a host. This is the same url i fill in my adress bar.
'host' => 'http://safetyanalyse.nl:2222/',
'host' => 'http://safetyanalyse.nl',
Both options do not work :( Do i have to put the port number somewhere else?
I also have this error:
SQLSTATE[HY000] [1130] Host 'D97A1650.cm-3-3a.dynamic.ziggo.nl' is not allowed to connect to this MySQL server
Step 2 (next i tried this).
In the error it says something about the host, i tried filling in this host.
'host' => 'D97A1650.cm-3-3a.dynamic.ziggo.nl',
Now i get the error:
SQLSTATE[HY000] [1045] Access denied for user 'safety_cert-user'#'d97a1650.cm-3-3a.dynamic.ziggo.nl' (using password: YES)
Try to use domain name as host, that should work.
Also, look for port, if specified.
All this information should be provided to you is hosting control panel. If not, I would change hosting provider.
Edit
Define your host without protocol.
In your app/config/database.phpset
'host' => 'safetyanalyse.nl',
I'm building the blog project example shown in the "definitive guide of symfony" (chapter 8: the model) on official webpage.
When i do operations that affects the database (like save();) in symfony, this message appears:
Unable to open PDO connection [wrapped: SQLSTATE[28000] [1045] Access denied for user 'root'#'localhost' (using password: NO)]
I tried to find errors in propel configuration files and nothing found. I just did what the guide says, nothing else. Maybe i need to create by command line the database or something like.
You need to properly configure databases.yml with a valid user and password for your MySQL server. Right now it's trying to connect as the root user with no password, and it appears that's not valid for your local MySQL configuration.