Connect To MYSQL Through Virtual Machine - mysql

I have windows and am running ubuntu 16.4 on a virtual machine for my analysis, I have installed and created user login and password to mysql databank through VM using this instruction:
https://www.digitalocean.com/community/tutorials/how-to-install-mysql-on-ubuntu-20-04
but now I don't understand how I can connect to it with my windows browser? Is it even possible to connect to mysql from my windows because technically I have installed it on another system (VM Ubuntu 16.4)?
I would appreciate if someone could guide me since I am a beginner. thanks

You don't connect to a database server like MySQL using a browser, but rather with a dedicated client program.
Some installations of MySQL also have a web program running called phpmyadmin. You can use that web program from your browser to do things to your MySQL server. But the digital ocean tutorial you followed doesn't install that.
You need a MySQL client program running on your Windows machine to connect to the MySQL server on your VM. Ansgar Becker's HeidiSQL is a good choice. So is MySQL Workbench from the MySQL team.
And, be sure you can ssh from your Windows machine to your VM before you try all this stuff. You'll need to know the IP address of your VM when you connect to your MySQL server from your MySQL client.
Let's say your Windows machine has IP 192.0.2.101 and your VM has IP 192.0.2.121. You need to follow the steps in this part of your tutorial to create a MySQL user profile that can connect from your Windows machine. Something like this.
CREATE USER 'xyz0o'#'192.0.2.101' IDENTIFIED BY 'someHardToGuessPassword';
FLUSH PRIVILEGES;
To create that user you need to ssh into your vm and run the mysql command line program.
Then from your client on your Windows machine you'll connect to the MySQL server on 192.0.2.121 using whatever username / password combination you gave in the CREATE USER command.

Related

Connecting to a remote MySQL database on a local PC using another PC

I want to develop a project for some college work. For this project i want to create a database in MySQL and I should be able to access this database from 2 different PC's which have MySQL workbench installed on it. I can use one of the PC's as the server or even a third PC as the server for the MySQL database. Someone please help me in doing this as i am unable to find any solutions online.
There's not much of an issue here.
Download and install the server from here.
Then install it on a computer within the same LAN of other computers
that will query the database.
Get the local ip of the computer on which the server is up and
running (on windows run cmd and then ipconfig) then look for
IPv4 Address value of the LAN.
Then establish the connection from other computers using that ip
value as host value configuration.

Custom Amazon EC2 instance and managing MySQL

so I've made an instance at amazon free web service, I've installed through putty mysql, php5, apache and so on on an ubuntu instance... But I can't for the life of me seem to find out how to manage the mysql on that instance. What am I missing? If I look in the Amazon RDS I can only manage for another instance, not for the one I have custom running...
As you have installed MySQL in the EC2 instance you can manage it via terminal.
Login to your instance using putty/ssh and connect to MySQL using below command
mysql --user=username --password=password
you need to install MySQL client if you installed on only MySQL Server.
If I look in the Amazon RDS I can only manage for another instance, not for the one I have custom running...
Yes, RDS is a service where Amazon manages the entire database box for you. The AWS Console manages (paid) RDS instances, not databases in general.
But I can't for the life of me seem to find out how to manage the mysql on that instance.
The "normal" way. Amazon doesn't come with CPanel or other GUI administration tools. Mainly because experts don't need them.
If you want to manage your MySQL graphically, install something like PHPMySQLAdmin or the like.
Note: never open the MySQL port to the internet. If you need to connect to MySQL, use "port forwarding" in Putty to forward port 3306 to the remote box port 3306. Then you can run a MySQL GUI client locally.

Connect SSH MySQL server from Windows

I have installed MySQL on Ubuntu using SSH and would like to connect phpMyAdmin installed on a Windows machine.
I tried to add a server like standard server, but I can not log in to MySQL server using SSH.
Does phpMyAdmin support to connect a remote server using SSH? If yes, how can I configure a private key for phpMyAdmin or do I need a SSH client for this?
I think there's a bit of misunderstanding that might be hindering you sorting this out.
SSH is the Secure Shell protocol, which allows a user to remotely access the command line of a server. You can access MySQL via SSH by using SSH to start a command line session on the server and using the mysql command line client as if you were at the machine directly.
phpMyAdmin can connect to a local MySQL instance (where MySQL and your webserver run on the same machine) or connect to another machine through the network (where MySQL is running on one machine and your webserver is running on another -- the connection in this case is via the the port used by MySQL itself, 3306). In either case, you can access phpMyAdmin itself from any browser on the network; it just appears as any web page. The communication between MySQL and phpMyAdmin can be encrypted (via SSL) if you wish, but still happens via MySQL communication and not over SSH. At no point is SSH used for the communication from the web server to the MySQL server.
So in your case, since you wish to install phpMyAdmin on the Windows box, you'd simply edit your config.inc.php to connect to the IP address or hostname of the Ubuntu server with the $cfg['Servers'][$i]['host'] = 'hostname'; directive, using the actual hostname instead. You'd then access phpMyAdmin from anywhere on the network by using the hostname or IP address of the Windows machine.
If, instead, you wish to install phpMyAdmin on to the Ubuntu machine, you could use the host name 'localhost' in config.inc.php and then access phpMyAdmin from the Windows machine (or any other machine) using the Ubuntu IP address/host name in your web browser.
It all depends which machine you wish to be the web server. phpMyAdmin runs under IIS or Apache runs under Windows, but Ubuntu makes installing all the programs easy through the package manager, so that's what I generally do in this situation.
Hope that helps clear it up a bit.

Does Mysql server start before windows login?

I have MYSQL installed in my Windows system. If I just turn on the system and leave it at the Windows Login screen without logging in, I'm still able to access the MYSQL DB from a remote system by knowing the IP.
Is this normal? Does MYSQL begin running even before login? Or is remote login somewhat different?
It's usually a windows service, and that indeed starts before you login.
Yes, MySQL service will start when Windows started and you can connect any MySQL hosted system on the network knowing IpAddress OR System Name.
If you want to block connecting your MySQL DB, ref: this link

How do I connect VS2010 to a MySQL database (locallay on another computer)?

I have a MySQL database on another windows computer (a server) that is setup locally using remote desktop connection for testing.
How can I connect to that local database to Visual Studio 2010 on "my computer"?
Server Computer(MySQL database setup local) --> My Computer(Visual Studio for test code..)
I am new to MySQL and any suggestions will help.
Thanks
PS: I have found this, but the "Server Name" for the database is 127.0.0.1 which I can't use because it is local on whatever computer you are on.
http://geekswithblogs.net/mbridge/archive/2010/12/13/visual-studio-2010-hosting--connect-to-mysql-database-from.aspx
You'll have to use the address of the computer that it is hosted on. It should be the same as the address you use to connect to the remote desktop session.
You might need to configure the firewall to accept the connection. You also might need to setup MySQL to allow remote connections with the user that you authenticate with.
I would recommend downloading MySQL workbench and install it on your local computer. Once you get the connection working with that, you should be able to use the connection with VS2010.
If you're not sure how to do the things listed above, you'll need to start out with a basic tutorial on setting up MySQL for remote connectivity.