On Synology DS218play, WordPress cannot connect to the user database, but phpmyadmin can - mysql

I am facing some issues while setting up my Synology DS218play. I hope you will be able to help me. Here is my current configuration :
I have a virtual host set with the Web Station app
Domain : blog.domain.com
Directory : web/blog.domain.com/wordpress/
HTTP Server : Nginx
PHP version : 7.0
HSTS and HTTP/2 checked
I have installed the MariaDB 10 and phpmyadmin packages from Synology Community repository.
I can log into phpmyadmin with root user, hence I created a blog user and a 'blog' database. blog user is granted with all privileges for blog database. I set localhost to hostname for blog user. I guess SQL Server is listening through 3306 port by default, I don't see where I can check or edit this.
I can log into phpmyadmin with my blog user, and I see only the blog database (and information_schema, I assume it is normal).
Here comes the problem : When I try to go to https://blog.domain.com, it redirects me to https://blog.domain.com/wp-admin/setup-config.php, I press 'Let's go!' and enter my credentials :
user : blog
password :
hostname : localhost
database name : blog
table prefix : wp_ (default value)
And when I validate, I go to an error page : error establishing a database connection. I triple checked user/password, it works into phpmyadmin and not with WordPress. So I assume the error comes from hostname, or phpmyadmin configuration to allow the connection from outside the phpmyadmin's interface. I would like to test directly on my NAS with mysql command line, but I have not found any solution to do that.
NB: I don't know if it is useful, but I set up my router to redirect the port 3306 to my NAS. It did not change anything.
Thank you for any help.

Using Apache instead of Nginx here, but I had the exact same problem on my Synology. It was solved by changing the hostname from localhost to 127.0.0.1:3307. This is the way to link to Maria DB 10. The port for Maria DB 5 would apparently be 3306 (not tested). Wordpress is now installed correctly and I can access the admin page.
But... this is not the end of the story. As soon as you will try to install a theme or a plugin, or update something, Wordpress will ask for FTP credentials to the Web Server. To make a long story short, Telnet your way as Default Admin (the SSH terminal and Admin Default User must be enabled) and type:
sudo su <--- To get root access
Use the same password
chown -R http:http /volume1/web/myfoldername <--- To give propre ownership
chmod -R 775 /volume1/web/myfoldername <--- To give propre access privileges
Everything works well from there.

Related

dbeaver mysql access denied

Can anyone tell me why I got an alert with the access denied error?
I tried to create a mysql database and I confidently sure I entered the correct password for root yet I still got this error.
However, based on the mysql documentation for troubleshooting, my error specified that I did not enter the correct password which in fact I did not.
Mysql documentation
https://dev.mysql.com/doc/refman/5.5/en/problems-connecting.html
Also , I tried to run this command sudo mysql -u root -pand it also show me the same error.
P.S Because my reputation is too low, I can't attach the full image.
might be check you are currently connect with the correct password plugin, use the following Command,
SELECT user, authentication_string, plugin, host FROM mysql.user;
If your are login with root, check whether plugin is "mysql_native_password" if not, change as it is with the following command.
ALTER USER 'root'#'localhost IDENTIFIED WITH mysql_native_password BY 'Password#123'
You may get this error when your mysqld is configured to accept connection only from localhost.
In such case, you need to modify bind-address property in /etc/mysql/mysql.conf.d/mysqld.cnf. You can allow only your ip or from the whole internet(0.0.0.0).
Make sure to restart the mysql server.
sudo systemctl restart mysql.
That's not it. You also need to allow connection on port 3306 using commands like ufw or iptables.
I had this problem on Beekeeper and DBeaver. It was driving me INSANE. I literally copied the password and was testing the connections manually and it was working perfectly. Annoyingly this server was working perfectly with MySQL workbench on Windows before I migrated over to Fedora.
So I needed to set the "SSH" section so that it would log me in to the other device. That test connection worked perfectly. But STILL no success. "Password failure" an incredibly inaccurate error message...
Turns out after enabling the SSH connection I forgot to change the "Server host" variable from it's IP (192...) to 'localhost'. Now it works perfectly.
It Could be various things try this:
In main configuration username="root" password="YOUR_PASSWORD" As in no need to put the actual password, only copy "YOUR_PASSWORD"
If it still doesn´t work leave the database bank
Check that your IP address is added to the server permissions/security
Check that the DB is available and that public connection is allowed
If using Windows allow connections to the port 3306 on the Firewall Defender(control panel, security, firewall defender, advanced setting, add inbound rule, port, 3306, allow)
For anyone struggling with SSH tunnel. I found that sometimes 127.0.0.1 is not being translated back to localhost before privileges are being check.
Try setting up a grant for 127.0.0.1 with the following.
GRANT ALL PRIVILEGES ON *.* TO 'user'#`127.0.0.1`;
This did the trick for me.
Please enter these configurations in connection window

AWS Lightsail Bitnami LAMP - Installing 2nd Wordpress Module not working

I have a LAMP stack on my AWS Lightsail server with one wordpress application currently. I am trying to load another wordpress intall, wordpresskva, on my server (not using multisite for personal reasons). So I ran the bitnami installer with --wordpress_instance_name wordpresskva. But it fails when I get to:
Create Admin account
Please enter the MySQL password for "root" for the existing Bitnami installation
Password :
I put in the application password (bitnami_application_password in the ~ directory) but it then says:
Warning: The installer was not able to connect to the MySQL server. Please make
sure MySQL is running and introduce a valid password to connect to the MySQL
server.
Press [Enter] to continue:
This is strange, since when I enter the same password here:
$ mysql -u root -p
Enter password:
It lets me get into the mysql server. I checked the status of the server and everything seems fine, so I am really confused as to what is wrong with the password/setup I am using.
Could you please help me troubleshoot this problem?
I guess you're following the guide below:
https://docs.bitnami.com/installer/apps/wordpress/#how-to-install-several-wordpress-modules-on-the-same-stack
And I also guess you're using the WordPress module installer below:
https://downloads.bitnami.com/files/stacks/wordpress/4.9.4-2/bitnami-wordpress-4.9.4-2-module-linux-x64-installer.run
I just launched a new LAMP Server on Lightsail and run the commands:
wget https://downloads.bitnami.com/files/stacks/wordpress/4.9.4-2/bitnami-wordpress-4.9.4-2-module-linux-x64-installer.run
chmod +X bitnami-wordpress-4.9.4-2-module-linux-x64-installer.run
sudo ./bitnami-wordpress-4.9.4-2-module-linux-x64-installer.run
And I chose /opt/bitnami as installation directory:
Please choose a folder that contains an installation of Bitnami.
Select a folder []: /opt/bitnami/
Then I use the use the password obtained from bitnami_application_password when prompted for the MySQL password:
Please enter the MySQL password for "root" for the existing Bitnami installation
Password :
----------------------------------------------------------------------------
WordPress
Please configure WordPress installation
As you can check everything worked as expected. Please repeat the process and ensure you type the password correctly (with no spaces), it should work.

Drupal install on remote mysql

I am trying to install drupal on remote mysql server. I have created the user in mysql and granted the the privileges.
I am able to connect through command line from my web server like this "mysql -u xxxx -h 10.xxx.yy.zz3 -p".
But when I tried to install drupal I get "SQLSTATE[28000] [1045] Access denied for user 'xxxx'#'localhost'". I have given the privileges for "xxxx"#"10.xxx.yy.zz3" but drupal appends localhost instead of IP to user name. I have changed settings.php to mysql server IP.
What am I missing?
Instead of editing the settings.php file, try the following:
The third screen during installation (Database configuration) let you set up the database on a remote MySQL server. To do so, expand Advanced options and enter the database host.
I cannot guarantee that this will work, but this is how I set up Drupal to use a remote MySQL server, and I have never had this problem. Btw, I always use the canonical domain name (e.g. mysql.example.org) and not the IP-address.

Cannot connect to Database server (mysql workbench)

Could you help me solve this problem ?
When I try to click "query database" under database menu in Mysql workbench. it gives me an error:
Cannot Connect to Database Server
Your connection attempt failed for user 'root' from your host to server at
127.0.0.1:3306:Can't connect to mysql server on '127.0.0.1'(10061)
Please:
Check that mysql is running on server 127.0.0.1
Check that mysql is running on port 3306 (note: 3306 is the default, but this can be changed)
Check the root has rights to connect to 127.0.0.1 from your address (mysql rights define what clients can connect to the server and from which machines)
Make sure you are both providing a password if needed and using the correct password for 127.0.0.1 connecting from the host address you're connecting from
The issue is likely due to socket authentication being enabled for the root user by default when no password is set, during the upgrade to ubuntu 16.04.
The solution is to revert back to native password authentication. You can do this by logging in to MySQL using socket authentication by doing:
sudo mysql -u root
Once logged in:
ALTER USER 'root'#'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
which will revert back to the native (old default) password authentication.
Now use password as the password whenever required by MySQL.
Try opening services.msc from the start menu search box and try manually starting the MySQL service or directly write services.msc in Run box
It looks like there are a lot of causes of this error.
My Cause / Solution
In my case, the cause was that my server was configured to only accept connections from localhost. I fixed it by following this article: How Do I Enable Remote Access To MySQL Database Server?. My my.cnf file had no skip-networking line, so I just changed the line
bind-address = 127.0.0.1
to
bind-address = 0.0.0.0
This allows connections from any IP, not just 127.0.0.1.
Then, I created a MySql user that could connect from my client machine by running the following terminal commands:
# mysql -u root -p
mysql> CREATE USER 'username'#'1.2.3.4' IDENTIFIED BY 'password';
-> GRANT ALL PRIVILEGES ON *.* TO 'username'#'1.2.3.4' WITH GRANT OPTION;
-> \q
where 1.2.3.4 is the IP of the client you are trying to connect from. If you really have trouble, you can use '%' instead of '1.2.3.4' to allow the user to connect from any IP.
Other Causes
For a fairly extensive list, see Causes of Access-Denied Errors.
Did you try to determine if this is a problem with Workbench or a general connection problem? Try this:
Open a terminal
Type mysql -u root -p -h 127.0.0.1 -P 3306
If you can connect successfully you will see a mysql prompt after you type your password (type quit and Enter there to exit).
Report back how this worked.
I had a similar issue on Mac OS and I was able to fix it this way:
From the terminal, run:
mysql -u root -p -h 127.0.0.1 -P 3306
Then, I was asked to enter the password. I just pressed enter since no password was setup.
I got a message as follows:
Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL
connection id is 181. Server version: 8.0.11 Homebrew.
If you succeeded to log into mysql>, run the following command:
ALTER USER 'root'#'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
You should get a message like this:
Query OK, 0 rows affected (0.19 sec)
Now, your password is "password" and your username is "root".
Happy coding :)
Run the ALTER USER command. Be sure to change password to a strong password of your choosing.
sudo mysql # Login to mysql`
Run the below command
ALTER USER 'root'#'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
Now you can access it by using the new password.
Ref : https://www.digitalocean.com/community/tutorials/how-to-install-mysql-on-ubuntu-18-04
I had to start Workbench as Administrator. Apparently it didn't have the required permissions to connect to my localhost database server process.
Right-click the Workbench shortcut and select Run as Administrator. In the shortcut's Properties window, you can click on "Advanced" and tick the box next to "Run as Administrator" to always run the Workbench with Admin privileges.
The error occur because the mysql server is not starting on your computer. You should start it manually. Do following steps:
Download and install wamp server according to your bit version(32bit or 64bit) in your computer(http://wampserver-64bit.en.softonic.com/) this link allows you to download wamp server for 64bit.
As soon as you install it you can double click and run it..(you can see a icon in the right hand of the taskbar.It may be hidden .so you can click the arrow which show you the hide apps runing).So click the icon and go to Mysql
Then go to Service and there you can find Start/Resume Services click on it..
And now it is done.Open mysql workbench and see.It will work..
I had same problem with Workbench on Ubuntu, problem was with permission.
Find Workbench app
Click button Permissions
Give all permission for this app
I struggled with this problem for awhile and did several reinstalls of MySQL before discovering this.
I know that MySQL server was running OK because I could access all my DB's using the command line.
Hope this works for you.
In MySQL Workbench (5.2.47 CE)
click Mange Server Instances (bottom right corner)
click Connection
in the Connection box select:
Local Instance ($ServerName) - root#127.0.0.1:3306 '<'Standard(TCP/IP)>
click Edit Selected...
under Parameters, Hostname change localhost or 127.0.0.1 to your NetBIOS name
click Test Connection
If this works for you, great. If not change the hostname back to what it was.
Even I faced a similar error when I opened MySQL Workbench.
The solution that worked for me was:
Click on the Start button on a Windows machine
Type services and press Enter
Find MySQL and click on it
On the top side of the left panel, you will find an option as Start the service
Click on Start which is visible as a hyperlink
Forr me reason was that I tried to use newest MySQL Workbench 8.x to connect to MySQL Server 5.1 (both running on Windows Server 2012).
When I uninstalled MySQL Workbench 8.x and installed MySQL Workbench 6.3.10 it successfully connected to localhost database
For those who ignored that the initial error message displaying is the following one:
The name org.freedesktop.secrets was not provided by any .service files
Make sure to install gnome-keyring using the following
sudo apt install gnome-keyring
I tried these steps -
Step 1 : Go to Ubuntu Software Center
Step 2 : Searched for MySql Workbench
Step 3 : And Click on Permissions
Step 4 : Enable Read, add, change or remove saved passwords
Then, enter Login Password
And then, I found that my problem solved
The problem is that MySQL server is not installed.
You can get the installer from here.
Then watch this 6-minute installation tutorial.
If then creating a new connection in MySQL Workbench is not working, make sure you run that connection as root as show below:
If you don't find your .ini file, check this answer (also written below).
Enter "services.msc" on the Start menu search box.
Find MySQL service under Name column, for example, MySQL56.
Right click on MySQL service, and select Properties menu.
Look for "Path To Executable" under General tab, and there is your .ini file, for instance, "C:\Program Files (x86)\MySQL\MySQL Server 5.6\bin\mysqld.exe" --defaults-file="C:\ProgramData\MySQL\MySQL Server 5.6\my.ini" MYSQL56
I was in similar situations before and last time I found it was some Windows update issue(not sure). This time, I opened MySQL workbench and found no connection to my local database. I cannot see my tables, but yesterday I could connect to the database.
I found that my cause is that, after letting my computer sleeping for some time and wake it again, the mysql service is not running.
My solution: restart the service named "mysql" and rerun the workbench. Restarting the service takes a while, but it works.
To be up to date for upper versions and later visitors :
Currently I'm working on a win7 64bit having different tools on it including python 2.7.4 as a prerequisite for google android ...
When I upgraded from WB 6.0.8-win32 to upper versions to have 64bit performance I had some problems for example on 6.3.5-winx64 I had a bug in the details view of tables (disordered view) caused me to downgrade to 6.2.5-winx64.
As a GUI user, easy forward/backward engineering and db server relative items were working well but when we try to Database>Connect to Database we will have Not connected and will have python error if we try to execute a query however the DB server service is absolutely ran and is working well and this problem is not from the server and is from workbench. To resolve it we must use Query>Reconnect to Server to choose the DB connection explicitly and then almost everything looks good (this may be due to my multiple db connections and I couldn't find some solution to define the default db connection in workbench).
As a note : because I'm using latest Xampp version (even in linux addictively :) ), recently Xampp uses mariadb 10 instead of mysql 5.x causes the mysql file version to be 10 may cause some problems such as forward engineering of procedures which can be resolved via mysql_upgrade.exe but still when we try to check a db connection wb will inform about the wrong version however it is not critical and works well.
Conclusion : Thus sometimes db connection problems in workbench may be due to itself and not server (if you don't have other db connection relative problems).
My problem was that the MySQL server wasn't actually installed. I had run the MySQL Installer, but it didn't install the MySQL server.
I reran the installer, click "Add", and then added MySQL server to the list. Now it works fine.
In my case I have just installed MySQL Workbench but after uninstalling MySQL Workbench and installing MySQL installer and is same for both 32 and 64 bit then after it working like a charm. Hope it could be useful.
I just use:
sudo snap connect mysql-workbench-community:ssh-keys
sudo snap connect mysql-workbench-community:password-manager-service
I also struggled with this problem for quite a while.
I came accross this interesting thread from MySQL forum: http://forums.mysql.com/read.php?11,11388,11388#msg-11388
I also came accross (obviously) some good SO Q/A.
It seems that the message mentioned in "user948950" 's question can be coming from a wide range of reasons: log file too big, incorrect mysql.ini file values, spaces in the file path, security/acl issue, old entries in the registry, and so on.
So, after trying for 3h to fix this... I abandonned and decided to do a good old re-install.
This is where this post from (again) this MySQL thread came in useful, I quote:
Gary Williams wrote: Hi Guys,
I've had exactly the same problem and this is how I got it working
for me, starting with a non working installation.
Stop the windows service for any existing mysql installation.
Uninstall Mysql.
As with most uninstalls, old files are left behind. If your directory
is C:\mysql\ etc then delete the innob, etc, files but leave the
directories themselves as well as any existing databases in 'data'.
If your directory is C:\Program Files\ etc, delete all the mysql
directories.
It's now worth running regedit to make sure the old registry entries are deleted as well by the uninstall. If not, delete them.
It's ok to use the new .msi installer (essential files only), however ....
Do not use their default install path! Some genius set a path with spaces in it! Choose the custom install and select a sensible path,
ie, C:\mysql (note from Adrien: C:\mysqldata for ... the data)
Do not choose to alter the security settings. Uncheck the relevant box and the install will complete without having to set a root
password.
I think I have remembered everything.
Good luck
Gary
I did get into troubles when simply copy/pasting the databases I had in my previous "data" directory to the new one. So the work around I found was to export each database (I know... a lot of fun) and then re-import them one by one.
FYI: I used the following command to import C:/<MySQLInstallDir>/My SQL Server x.x/bin/mysql -u root -p <dbName> < "<dirPathOfDump>\<dumpName>.sql", that is for instance C:/mysql/MySQL Server 5.6/bin/mysql -u root -p mySupaCoolDb < "C:\mySupaCoolDbDump20130901.sql"
2022 and beyond this works for me:
sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf
change
bind-address = 127.0.0.1
to
bind-address = 0.0.0.0
Then remember to restart mysql sudo systemctl restart mysql
Initially I was confused, but I was able to solve the problem.
If your workbench was downloaded through the Snap package manager you could easily use this command to solve the problem, very simple:
sudo snap connect mysql-workbench-community:password-manager-service :password-manager-service
Go to services.msc and find MySQL.
If "Log on As" section is 'Network Service', then:
Double click on the MySQL row to open a pop-up
go to "Log on" tab
Select Log on as: "Local System account" and check "Allow service to interact with desktop"
Voilà, now you can start your service on localhost and make sure you enter correct root/user password on your MySQL Workbench, and you are good to go.
If you are using snap to install mysql workbench, try this:
sudo snap connect mysql-workbench-community:password-manager-service :password-manager-service to allow sandboxed package to access password service
askubuntu.com/a/1242777/1621549
This Solution was made as a comment before by Rohim Chou

Question related to mysql gem new method authentication

I normally code on windows and using MYSQL4.1. And mysql gem version is 2.8.1. In my setup when I use mysql gem to access the MYSQL server, I give the root username and password of the sql server. And in rails db config file, I give user name as 'root' and its password and host as 'localhost'. My rails server and Mysql server are running on the same machine.
But recently I had to do a project in which I had to access the MYSQL server installed at a client site. It is a linux machine. I am not sure of the sql server's version number. To access it I was given a username and password for SSH and the root username and root password of the SQL server also. But for accessing that machine, in the mysql new method I have to specify the ssh login and user-password instead of sql user and password.
I cant access the DB if I give the MySql root user and password.
So, mysql.new(machine's public IP, ssh login id, ssh login password, db_name) works whereaes mysql.new(machine's public IP, 'root, root password, db_name) does not work. I am not sure, I understand what is happening. So, my question is can anyone explain this login behavior? Why cant I access the mysql server with the sql server's root login and root password.
To expand a little bit on what adamaig said:
When you're logged into the MySQL console as root, do this:
use mysql;
select User, Host from user;
MySQL should give you a table with the accounts and their respective hosts. You'll probably see that root can only log in from '127.0.0.1' or 'localhost'. You'll also probably see another account with credentials identical to those of the ssh account that was given to you.
Also, I would advise against giving root permission to log in from everywhere, it is a security risk.
But, if you ssh directly into the machine (using something like PuTTY if you're on Windows), you'll be able to log in as root from there.
Sounds like you need to create a user in the remote db that allows remote login. The root account is typically not given permissions to login from '%' . Try looking at the mysql.user table to see what the permissions are. Then you might want to look at the mysql.com developer documents on setting up accounts and security. The answers there will be fuller than can be given here.