I have a Raspberry Pi (first model) I use as a server. I followed a tutorial and installed Apache2, MySQL, Phpmyadmin etc.
I have also set up a ddns for my home network to be able to connect to it wherever I am, and of course forwarded the necessary ports.
At first everything worked wonders.
I could connect to the database using phpmyadmin by navigating to adress/phpmyadminfrom any network.
I could also use HeidiSQL to connect to the database, again from any network.
The MySQL version I had at this time was v5.5. I wanted a feature available on v5.6 but this version was not available on my RPi (ARMv61). Instead it seemed like MariaDB should do the trick. So I updated to MariaDB using the command:
sudo aptitude install mariadb-server
Now I am not able to connect through HeidiSQL anymore, Phpmyadmin still works though from any network just like previously. Trying to connect with HeidiSQL I get the output (no matter what username/password i try):
Can't connect to MySQL server on 'adress' (10061)'
mysql -V gives output:
mysql Ver 15.1 Distrib 10.0.27-MariaDB, for debian-linux-gnueabihf (armv7l) using readline 5.2
My RPi info is
Linux redface 4.4.26+ #915 Thu Oct 20 17:02:14 BST 2016 armv6l GNU/Linux
The user privileges are available in the image below
How can I connect to the database again using HeidiSQL? Have I missed something with the user privileges?
With phpmyadmin I use the username root
This particular error is not about permissions.
The code (10061) is WSAECONNREFUSED -- a Windows socket error code for Connection refused, not to be confused with "access denied."
Connection refused typically means no service is listening on the target IP address and port. MariaDB is not listening on 0.0.0.0:3306.
mysql -V only tells you the installed client version -- it doesn't tell you anything about the MariaDB server.
Access to phpMyAdmin doesn't tell you anything, either, because with it, you're not talking to the database server remotely -- you're talking to your web server remotely, and your web server is running code that talks to the database locally from within the same machine, and often uses a different mechanism of server access that is not TCP/IP.
Check the config file for a commented-out bind_address=0.0.0.0 or similar.
https://mariadb.com/kb/en/mariadb/configuring-mariadb-for-remote-client-access/
Related
When attempting to connect to remote MySQL server from my Windows machine using MySQL workbench - I get an error about connecting to localhost (unsure where the software is picking up localhost). However when I attempt to connect through an SSH tunnel it connects just fine (I cannot use this for the software I am creating though)
when I run netstat on the server:
netstat command
...(more entries)
the bind address has been altered in mariadb and mysql configs. if there are any more configs people would like to see to help with solution please let me know. I have also set up the user in mysql to allow remote privileges:
mysql users
I am pretty confused.
I have installed and running MariaDB server on a raspberry 4. I am trying to connect with Dbeaver but i am unsuccessful.
Hosting db details:
Raspbian: GNU/Linux 10 (buster)
mariadb: Server version: 10.3.34-MariaDB-0+deb10u1 Raspbian 10
Client access:
Dbeaver: Version 22.1.5.202208211008
phpmyadmin
Now as you see, I have installed phpmyadmin as well and I can successfully connect to host. Also I can ssh remote connect.
However Dbeaver refuses to connect and times out.
What I have tried so far:
I have configured mariadb in 50-server.cnf to bind to 0.0.0.0
I have added an admin user account in mysql with all rights and is stated as admin#192.168.1.x, where the ip is the remote pc's ip with the Dbeaver.
I have tried adding also "admin"#"%"
What should I troubleshoot next?
What worked for me, after some tries, was that I went to Dbeaver connection settings/SSH/ and ticked the use SSH tunnel.In Settings I filled the server details and pi user and password.
Testing and connection was successful after some questions/answers about creating a key and a couple of directories.
I wend back to the connection and I was able to expand the connection view tree with Table/Views/etc
I am not sure why I needed the SSH tunnel to connect. It was not stated to any tutorial I used. Maybe someone in the community can help with this.
I recently setup MySQL Server on my computer. But the command line client asks for the password and simply closes without showing anything.
The mysql connector for python can't connect to it either.
import mysql.connector
mydb = mysql.connector.connect(username='username',passwd='password')
Just gives
InterfaceError: 2003: Can't connect to MySQL server on '127.0.0.1:3306' (10061 No connection could be made because the target machine actively refused it)
I saw somewhere that setting the host to localhost might help.
import mysql.connector
mydb = mysql.connector.connect(username='username',passwd='password',host='localhost')
But even then:
InterfaceError: 2003: Can't connect to MySQL server on 'localhost:3306' (10061 No connection could be made because the target machine actively refused it)
The target machine actively refused it?
This already happened once and I reconfigured MySQL Server from the MySQL Community Installer which temporarily got it to work on both the command line client and with the python connector. Is there any way to permanently fix this?
Here are the versions of software I'm using:
MySQL Server 8.0.21
MySQL Server Installer 1.34.4.0
Python 3.8.2
JupyterLab 2.1.2
EDIT: Should've mentioned I'm running Windows 10.
#replace username as user and it should work
import mysql.connector
mydb = mysql.connector.connect(user='username',passwd='password',host='localhost')
If the MySQL80 Command line Client it is closing after you enter the pwd means that you're entering a wrong password. Typically the password that it's asking is the root password.
For such a case check this page:https://dev.mysql.com/doc/refman/8.0/en/mysql-installer-workflow.html#mysql-installer-workflow-server and eventually you may have to reset your root pwd and your user accounts.
With the help of #Erick, I got MySQL working for me. So MySQL is usually installed as a service on windows and is set to manually start every session. This was why reconfiguring worked but only that once. What you need to do is go to services, and look for MySQL80. If it isn't already running (which was what happened to me), double-click it to start, and set 'Start type' to automatic so that the MySQL Server starts automatically during system start-up. For me, doing this made both the client and python able to connect to the server :).
I'm trying to connect to mysql workbench but I get the following error
Error Message
Cannot Connect to Database Server
Your connection attempt failed for user 'root' from your host to server at
127.0.0.1:3306:
Could not open database.
Please:
1. 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
When I Test Connection, the parameters are correct, and actually I can enter and manage database in console.
When I installed Mysql for first time I could enter to Workbench one time and if I closed Workbench I had to restart my PC to connect another time.
I reinstalled 2 or 3 times Mysql server and Workbench and now I cannot connect from Workbench even once.
I faced similar issue and resolved it by following these steps:
In the terminal, execute this command
mysql -u root -p -h localhost -P 3306
Enter the password
This will be displayed
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 18
Server version: 8.0.16 Homebrew
Now do,
ALTER USER 'root'#'localhost' IDENTIFIED WITH mysql_native_password BY 'root';
Now you should be able to login and connect to DB in the workbench with password 'root'
I don't know if it helps anyone, but I had the same problem on windows after updating from MySQL 5.7 to 8.0.
The solution for me was to go to services.msc, stop the MySQL service and start the "MySQL80" service instead.
Then I restarted MySQL Workbench (run as admin) and it worked.
Please make sure that You have Downloaded MySQl server while dowloading MySQl workbench from MySQl installer (if you have checked Custom download)
I had the same issue a few days ago. As I could see in the original question, there has been multiple MySQL installation on the same computer - the same flow I tried after failing in the first attempt.
In the case we are trying to reinstall MySQL, we should be aware of remaining hidden files after MySQL has been uninstalled for the first time. In order to remove them all (and make one successful installation), we should:
Make hidden files visible on your computer (instructions)
Delete all files related to MySQL after choosing uninstalling of the MySQL (I had to check C://ProgramData hidden folder)
Try a new installation
I think that during the first installation, I didn't have all required dependencies on the computer (for example Python) and the installation failed. After installing it, uninstalling the MySQL, and taking steps from above, I finally managed to run it successfully :)
I hope this could help someone! :)
This solved it for me (MAC OS)
Open MySQL from System Preferences > MySQL
Click 'Stop MySQL Server' if the server is running
Select 'Initialize Database'
Type your new password.
Choose 'Use legacy password'
Start the Server again.
Now connect the MySQL Workbench
I had installed wamp that come up with PHP Apache and MySQL. I don't need PHP and Apache I am making a Java EE app with Tomcat. I want to connect from a Servlet to MySQL Database
Class.forName("com.mysql.jdbc.Driver");
con =DriverManager.getConnection
("jdbc:mysql://ADDRESS_MYSQL/DATABASE_NAME","USERNAME","PASSWORD");
The reason is I am unable to get the address of MYSQL, I had opened the sql.ini file and saw that it is running on 3306 but couldn't get the address.
How can I get the address for connecting with the DB?
Check the system tray icon for WAMP, make sure MySQL service is running. During setup you should have been prompted to setup the root password. In that case, if MySQL is running you should be able to connect to localhost:3306 with root to test your MySQL instance. I suspect MySQL service is not running and needs to be started.
All the best.