Synology MSQL connection error - php

I tried to move a database from XAMPP to my Synology NAS.
Now I get this error:
Warning: mysqli_connect(): (HY000/1045): Access denied for user 'qs'#'localhost' (using password: YES) in /volume1/web/db.php on line 3
In the Database i created a User:
Name: qs
password: test
host: %
privileges: all..
in php i use:
$link=mysqli_connect("localhost","qs","test","qs",3306);
localhost because the Synology is the localhost of the web-page. i also tried to change to:
$link=mysqli_connect("10.0.0.99","qs","test","qs",3306);
then it says:
Warning: mysqli_connect(): (HY000/1045): Access denied for user 'qs'#'JF_SYN' (using password: YES) in /volume1/web/db.php on line 3
"JF_SYN" is the name of my Synology
i also tried to set the host of the database user, to that specific IP, but that doesn't change anything.
Database connection is working with this user and the password, i tried with HeidSQL,MSYQL-Workbench and Oracle SQL Developer, all those tools can make a connection.

I had the same issue, with my Synology NAS
Use MyAdmin and remove the “ANY” or “Anonymous” user accounts.
This should Fix your issue.

Related

Warning: mysqli_connect(): (HY000/1045): Access denied for user 'root'#'localhost' (using password: YES) in C:\wamp64\www\web\db.php on line 3

( ! ) Warning: mysqli_connect(): (HY000/1045): Access denied for user 'root'#'localhost' (using password: YES) in C:\wamp64\www\web\db.php on line 3
Call Stack
# Time Memory Function Location
1 0.0840 407896 {main}( ) ...\registration.php:0
2 0.0850 408192 require( 'C:\wamp64\www\web\db.php' ) ...\registration.php:73
3 0.0850 408192 mysqli_connect ( ) ...\db.php:3
Failed to connect to MySQL: Access denied for user 'root'#'localhost' (using password: YES)
Everything look ok, but still getting problem in connection with phpmyadmin.
It seems like you're using WAMP. WAMP's default user is root and the password is blank (unless you had changed it). You're connecting to MySQL with a password (see using password: YES), it needs to be using password: NO; meaning logging in with a blank ('') password. In \db.php:3 rewrite the MySQL password for mysqli_connect with '' and try again.

Unable to login into MySql after changing default_authentication_plugin=mysql_native_password

I have MySql 8.0 freshly server installed. Initially, I was able to log in, but when I tried to connect to it through PHP PDO I got this error:
Fatal error: Uncaught PDOException: PDO::__construct(): The server
requested "authentication method unknown to the client
[caching_sha2_password]"
I read from StackOverflow a solution here
Open your my.cnf (in my case the my.ini file) and add the following
entry (and restart MySQL)
[mysqld]
default_authentication_plugin=mysql_native_password
Create a user (your MYSQL_USER name) using the correct 8.0 syntax for
generating the password (see below) <---- Altered my existing user
"root"
IDENTIFIED WITH mysql_native_password
Flush the privileges and try again.
After I restarted the MySql service I'm now unable to log in to MySQL. with it saying this error now:
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using
password: YES)
I want to be able to log in through PHP PDO, but I can't even log back in through regular command prompt or MySQL Workbench. Any help on this would be great.

Access Denied after upgrading old Xampp in Windows 10

I've upgraded from a 6 year old Xampp to the next latest one:
xampp-win32-7.0.23-0-VC14-installer.exe
Before install I did a Mysql Dump All:
mysqldump -u root -p --all-databases > all-db-dump.sql
After install I Imported that all-db-dump.sql from phpMyAdmin.
When starting my PHP-application filmtv.php I get the above errors, see attached filmtv.php.png.
Look at the source samples and I hope someone out there have an idea of whats wrong, cause I expected it to work smoothly without having to change my application.
Also, if I do a minor change using phpMyAdmin like adding a new user then I cannot use phpMyAdmin anymore it'll respond that user/pwd is incorrect, very strange. Up to now I've done 5 re-installs because of that.
From phpMyAdmin user:
root localhost Yes ALL PRIVILEGES
filmtv.php
Warning: mysqli_connect(): (HY000/1045): Access denied for user 'root'#'localhost' (using password: YES) in C:\xampp\htdocs\css\bertil.php on line 2
Warning: mysqli_connect(): (HY000/1045): Access denied for user 'root'#'localhost' (using password: YES) in C:\xampp\htdocs\css\bertil.php on line 3
Fatal error: Uncaught Error: Call to undefined function mysql_error() in C:\xampp\htdocs\filmtv.php:156 Stack trace: #0 {main} thrown in C:\xampp\htdocs\filmtv.php on line 156
filmtv.php includes
include 'css/adam.php';
include 'css/bertil.php';
if (!$cxn) { echo "Unable to connect to DB: " . mysql_error();
exit;}
Source-code:
*adam.php:*
<?php
$user="root";
$host="localhost";
$password="tenthirty";
$database = "ljung";
?
*bertil.php:*
<?php
$cxn = mysqli_connect($host,$user,$password,$database);
$cxu = mysqli_connect($host,$user,$password,$database);
?>
_By the way, my Xampp install is:
Includes: Apache 2.4.27, MariaDB 10.1.26, PHP 7.0.23, phpMyAdmin 4.7.4, OpenSSL 1.0.2, XAMPP Control Panel 3.2.2, Webalizer 2.23-04, Mercury Mail Transport System 4.63, FileZilla FTP Server 0.9.41, Tomcat 7.0.56 (with mod_proxy_ajp as connector), Strawberry Perl 7.0.56 Portable_
_
Cheers,
Torbjorn
Stockholm
In the newest version of Xampp they start to use mariadb instead of mysql
so you can't log in as root user so you have to create new user and grant your privileges in that user

Access denied for user#localhost [duplicate]

This question already has answers here:
MySQL ERROR 1045 (28000): Access denied for user 'bill'#'localhost' (using password: YES)
(43 answers)
Closed 5 years ago.
I have installed xampp on Windows and am using phpmyadmin to create a database. When I paste the link of my php file corresponding to the database onto the browser I get the following error:
Warning: mysqli_connect(): (HY000/1045): Access denied for user 'id2207666_aditijha20'#'localhost' (using password: YES) in C:\xampp\htdocs\Register2.php on line 3
I tried the 'Grant Permission' command in SQL but that didn't work either.
GRANT ALL PRIVILEGES ON id2207666_perfect_fit.* TO 'id2207666_aditijha20'#'localhost' WITH GRANT OPTION;
ERROR: #1044 - Access denied for user 'id2207666_aditijha20'#'%' to database 'id2207666_perfect_fit'
How do I fix this?
Thanks in advance
there's a difference between 'id2207666_aditijha20'#'%' and 'id2207666_aditijha20'#'localhost'
Issue your grant for the user that you're using to connect:
GRANT ALL PRIVILEGES ON id2207666_perfect_fit.* TO 'id2207666_aditijha20'#'%' WITH GRANT OPTION;
Also, you may need to flush privileges

Error 1045 access denied for user 'ODBC'#'localhost' (using password no)

I'm absolutely new to this area. I am getting the following difficulty:
When I try the mysql command on the shell, Start->cmd->mysql:
Error 1045 (28000): Access denied for user 'ODBC'#'localhost' (using password: NO)
I don't know why, because if i try to access in MySql by QueryBrowser it works fine.
If i try to connect by a PHP script:
<?php
$conn=mysql_connect("localhost", "username_of_Admin", "password_of_Admin");
$db=mysql_select_db("db_name");
if (!$conn)
{
printf("Connection Error: %s", mysqli_connect_error());
exit();
}
?>
I receive the error:
Connection Error:
From Windows MySQL installer:
mysql-essential-5.0.27-win32 and
mysql-gui-tools-5.0-r6-win32
for some reason, the ODBC user is the default username under windows even if you didn't create that user at setup time. simply typing
mysql
without specifying a username will attempt to connect with the non-existent ODBC username, and give:
Error 1045 (28000): Access denied for user 'ODBC'#'localhost' (using
password: NO)
instead, try specifying a username that you know, for example:
mysql -uroot -p
You should not use
mysqli_connect_error() if you use mysql_connect().
try
$conn=mysql_connect("localhost", "username_of_Admin", "password_of_Admin");
if(!$conn){
print mysql_error();
}
From my sense I think you are giving wrong userid or password.
check it carefully that your user id and password are correct.
I got the same error:
ERROR 1045 (28000): Access denied for user 'ODBC'#'localhost' (using
password: NO)
When opening MySQL Command-Line Client with the command below:
mysql
So instead, I used the command below, then I could open MySQL Command-Line Client:
mysql -u root -p

Categories