Ubuntu - xampp - could not import database to mysql - mysql

I have a project which needs to be run on PHP 5.5. I created a virtual machine with Ubuntu. I have windows 10 on my machine. I could not found version of lamp supporting PHP 5.5, so I installed Xampp. It works and also phpmyadmin works. But when I try to import database from command line, it says - "The program 'mysql' can be found in the following packages......". It asks to install the package.
The client wants to stick to the current PHP version, until we are up and live with latest versions of PHP.
Do I need to install mysql package separately? Is it possible to use it with Xampp ?
Or can I connect to the database on host (windows 10) ?

I tried to remove the mysql related files and folders, but due to file permissions, I could not remove all. With less time in hand, I tried to connect to the host database (xampp installed on windows 10), and it worked.
Here is what I did -
Run ipconfig (My host is windows 10).
Note the IPv4 address, under "Ethernet adapter Ethernet:".
Run following queries on host database (xampp installed on windows 10) -
CREATE USER 'yourusername'#'IPv4 address:port' IDENTIFIED BY 'yourpassword';
GRANT ALL PRIVILEGES ON . TO 'yourusername'#'IPv4 address:port' WITH GRANT OPTION;
CREATE USER 'yourusername'#'%' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON . TO 'yourusername'#'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;
I used port 3306.
While connecting, I used the IPv4 address:port as host, username = yourusername and password=password.
I hope this helps somebody.

Related

MySQL said: Host '10.10.10.121' is not allowed to connect to this MySQL server

In my office, there is a desktop computer which is CentOS7.2 system, there installed MySQL on it.
and in my computer, I have a Sequel Pro on it.
I want to use the Sequel Pro to connect the desktop computer's mysql.
But there gets this error:
Unable to connect to host 10.10.10.127, or the request timed out.
Be sure that the address is correct and that you have the necessary privileges, or try increasing the connection timeout (currently 10 seconds).
MySQL said: Host '10.10.10.121' is not allowed to connect to this MySQL server
The desktop computer ip is 10.10.10.127, mine is 10.10.10.121.
As your situation, you should set the remote login user privileges in your mysql:
In your desktop computer, you login to the mysql:
mysql -u root -p
grant the priviliges
GRANT ALL PRIVILEGES on yourDB.* to 'root'#'10.10.10.121' IDENTIFIED BY 'the password';
flush privileges
Then you can use the tool to connect the desktop computer's mysql in your computer.
You'd better fixed the desktop computer and your computer's LAN ip .
The mysql user you are using is not having the access permission to the server. Provide the access like
GRANT ALL ON foo.* TO bar#'162.54.10.20' IDENTIFIED BY 'PASSWORD';
Where foo is the database name , bar is the user.
You may also consider creating new mysql user to access from your machine.
I hope this helped. For more information check out http://www.debianhelp.co.uk/remotemysql.htm .

MySQL remote connection to Linux

Do I have to install MySQL on Windows to be able to connect to a MySQL server running on Linux and edit the files from windows ? Because I was installing the Workbench for SQL (I'm using MySQL Workbench Guide, Source: MySQL Workbench), then allow access to Linux (vps) from my pc, when I tried to install it, I'm stuck in the Windows config settings. Can someone help? (Screenshot provided.)
1 more thing: the program said "installing wmi" then "Could not set up connection: Could not connect to target machine."
you can install only workbench in windows without installing mysql server but you need to create a user on linux mysql server, who can then access it from the windows machine:
CREATE USER 'newuser'#'IP of the windows machine' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'newuser'#'IP of the windows machine';
FLUSH PRIVILEGES;
if you want the user to access regardless IP then you can use '%' instead of IP

How can I connect to MySQL from NetBeans

NetBeans is installed on my pc.
I installed mysql on the raspberry pi using sudo apt-get install mysql-server.
To connect to the database from NetBeans I use the
New connection wizard
where I select
MySQL(Connector/J driver)
I leave it all as it is except the password. In the password I write the one that MYSQL prompt me to enter when it was installing.
When I press "Test Connection" I get "Cannot establish a connection to ...".
Did I miss something to install on the raspberry pi?
I am using a static IP address(inet addr).
My PI and pc are in the same network.
You need to set permissions in mysql:
GRANT ALL PRIVILEGES ON mydb.* TO 'root'#'%' WITH GRANT OPTION;
This will allow remote connections to access the database. You also need to change the listening interface in the /etc/my.cnf file. Look for bind-address 127.0.0.1. Change this to the ip address of your pi.
Just because you installed the mySQL-server package does not mean you have created a database yet. The easiest would be to SSH to your pi and use the command line to create one, or alternatively you can use mySQL workbench from your pc assuming you started the daemon on your pi. You will need to name your database and the name will be part of the URL you use to connect to it via NetBeans. You also may need to enable outside connections to mySQL. You may also need to download the JDBC driver for mySQL either manually or through NetBeans.

How to open remote mysql database on windows from command prompt

Environment:
I have a database on CentOS
The folder where it is saved is shared using SAMBA
Windows have access to the files at \\192.168.1.101\mysql\food\
MySQL-server is running on both systems
Problem:
I need to access the database on windows using mysql from CMD
Extra info:
I open mysql on CMD by running:
C:\Program Files\MySQL\MySQL Server 5.6\bin>mysql -h localhost -u root -p
mysql>
I can not display the table on \\192.168.1.101\mysql\food\ because is not the default folder for mysql
Question:
how can i change the default folder on mysql-windows to open my database? do I need something else to display the database? like add a user to mysql-server on centos and grant access
you can connect to a different host by running mysql -h 123.45.67.89. Please note that there are a few security implications:
1.You will have to grant yourself access. You will need to run something like GRANT ALL on db_name.table TO user#your_ip IDENTIFIED BY 'password'.db_name, table and your_ip can be * but beware of opening your server to hackers.
2.ou will have to open your server's firewall if you are not on the same LAN. Again, ymmv and you should be aware not to open the door to exploits.
3.You may want to use SSL( http://dev.mysql.com/doc/refman/5.1/en/mysql-command-options.html#option%5Fmysql%5Fssl ) and use secure-auth( http://dev.mysql.com/doc/refman/5.1/en/mysql-command-options.html#option%5Fmysql%5Fsecure-auth ) in order to protect your traffic and credentials.
Hope that helps.Thanks to you

How to access MySQL from a remote computer (not localhost)?

I have my dev environment set up as a Ubuntu Server (with LAMP installation) inside a vmware. The vmware is running on my local windows 7 machine. When I try to access my mysql server via HeidiSQL program the connection fails. I get a:
Server Error 2003, can't connect to mysql server on <IP ADRESS HERE>
I can however access the db server via PhpMyAdmin. MySQL is running and my connection credentials and port are all correct.
I read that you should enter the IPs of the computer you are trying to connect from as the "bind address" in the my.cnf file. Which I did. I tried both the internal network IP as well as the online IP. Still no luck, same message.
Since this isn't a production environment I would ideally like to allow anyone to access that server, not limit it by IP. Especially since my ISP assigns dynamic IPS. So I would have to change it all the time, assuming that even works.
So does anyone know how I can connect to my MySQL server from a remote computer?
P.S. I assume this is something developers have to deal with that's why I posted it here and not Super User. If it must be migrated please send it to Server Fault not Super User.
Ok, be aware this gives the world and his dog access to your mysql server.
GRANT ALL ON *.* to '%'#'%' WITH GRANT OPTION;
But say you are on your home network of 192.168.1.2/16 then you can at least limit it like this.
GRANT ALL ON *.* to '%'#'192.168.%' WITH GRANT OPTION;
Another option is that you have a user and password but want to connect from anywhere
GRANT ALL ON *.* to 'mysecretuser'#'%' IDENTIFIED BY 'mysecretpassword' WITH GRANT OPTION;
first check the ip assigned to vmware using from cmd
ipconfig/all
suppose ipassigned to vmware is 192.168.11.1
now in vmware in ubuntu check the ipadress
ifconfig
suppose ip adress of ubuntu is 192.168.11.137
now open mysql configurations
sudo nano /etc/mysql/my.cnf
change the bind address to ubuntu ip address
bind-address = 192.168.11.137
restart mysql
now connect to mysql
mysql -u root -p
and create a user with all privileges and host ip of vmware i.e 192.168.11.1
GRANT ALL ON db.* TO user#'192.168.11.1' IDENTIFIED BY 'PASSWORD';
now try to connect from windows.
also open port of mysql
/sbin/iptables -A INPUT -i eth0 -p tcp --destination-port 3306 -j ACCEPT
restart mysql and try to connect on ubuntu host ip address 192.168.11.137
For Heidi SQL I was able to get it to work following the instructions on this article:
http://mysql-tools.com/en/articles/http-tunnel/73-heidisql-a-http-tunnel.html
It uses a program called HTTP Tunnel. It's a lot slower but at least it works. If you use Navicat it comes with a PHP file that you can upload to your server and it will connect via that.