using mysql address of wamp - mysql

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.

Related

Error Connecting to Remote MySQL server hosted on Ubuntu from Windows

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.

can not connect to mariadb server using dbeaver

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.

Access Lightsail Instance's database with MySQL Workbench

I have an Amazon Lightsail Ubuntu multi WordPress site set up with bitnami stack.
I'm looking for a way to access the Instance's database on Amazon Lightsail with MySQL Workbench remotely.
Please note that I do not have a seperate Lightsail database, as I'm trying to do things as cheaply as possible at the moment. So the following guide is not applicable to me.
Connecting to your MySQL database in Amazon Lightsail
According the wp-config.php MySQL database is using localhost:3306
I have static IP address 3.230.xxx.xxx. I have taken the DB username and password from the wp_config.php file.
I've entered the details.
I wonder if anybody else has managed to connect to an Instance's database, rather than a seperate database.
If this is not possible I wonder if there are any suggestions as how to best access this Instance's database remotely.
Found the answer using a similar youtube video which is used to connect to phpMyAdmin.
https://www.youtube.com/watch?v=9VdcQLDmYII
Basically you need to use Putty SSH tunneling in order to connect to the MySQL instance
First I added a new connection in Putty, make sure port 22 is open on
the LightSail firewall
Go to the Connection -> SSH -> Auth tab on the right hand side menu
Enter your SSH key which is downloaded from the Lightsail dashboard,
it will need to be converted in the standard recognised by putty
Go to Connections -> Data tab on the right hand side menu. Add a new
forwarded port we are forwarding localhost:3306 on the server to a
port on our machine 2222
Start the connection via Putty.
Now in MySQL WorkBench go to the connection to database windows.
Enter the port 2222 I entered the DB user and Password from
wp-config.php file and was able to successfully connect.
Also found a second method
Within the MySQL Workbench you can change the connection method to `Standard TCP/IP over SSH'. Gave the SSH key and the relevant details on connection was accepted
Here is what you need to remotely connect MySQL on Lightsail.
https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-connecting-to-your-mysql-database
There are 3 steps:
get the endpoint link
enable public mode
configure MySQL workbench
Yes I have - after a marathon tech support session with AWS :)
Although the Lightsail firewall may say port 3306 is open, the server instance itself may have its own firewall settings which close it. On my case teh AMI that was used to set up the instance was configured that way
I my case it was Ubuntu but here is the summary of the advice I got from AWS--
We have connected to the instance via SSH using the user-name 'xxxxxx' from terminal.
--
ssh -l xxxxx 34.xxx.xxx.221
Checked and confirmed that mysql is running on the instance.
systemctl status mysql
Confirmed the port on which mysql is running.
netstat -plnae | grep 'pid'
Checked the 'ufw' firewall rules and noticed that 3306 is not allowed.
ufw status
Opened the port 3306 on ufw firewall
ufw allow 3306
After performing these steps you were able to establish connection to your database
hth

cannot connect to to database (netbeans, MAMP, Workbench)

I am having serious trouble connecting to MySQL server and I do not know why, I am trying to configure a netbeans project I am using MAMP, workbench and netbeans. I have configured MAMP so my Apache server runs on port 80 and MySQL to port to 3306, i have then configured workbench to work on port 3306, i have imported my netbeans project database to workbench, the database is present and connected to MyPHPAdmin, i have put the netbeans project in my 'MAMP/htdocs'folder, netbeans can see my project and is connecting to it but is not connecting to my database and I just cant figure out why, this is on an OSX machine, (I have also read posts about not using TCP/IP connection on workbench and to use local socket/pipe but that does not seem to work for me either, anyway I seem to be establishing a successful connection through TCP/IP...) Configuration setup

Can't connect to database (10061)

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/