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
Related
I would like couple things clarified.
(I have mysql client installed on my remote VM running on Ubuntu 16.04, goal is to access the database from within R but I have been trying so far with mysql as such: mysql -u root -p -h fe80::883f:XXXX:XXX:XXXXX -P 3306 where for "XXX" I tried every ip address I get in windows command line when the command ipconfig is issued.
To narrow down my troubleshooting I want couple pointers:
Do I need to give the IP address for my remote(cloud) instance in the mysql config file (thus find my.cnf or its equivalent in windows in dir where mysql server is installed and bind the address for the remote/cloud VM I am trying to access the db on my laptop from).
2 SSL, is this something that needs to be enabled?
Additionally, from Bash on Ubuntu on Windows (WSL) I am able to log into mysql server with `mysql -u root -p'xxx' -h ' i.e. the ip address from windows command line ipconfig output called "Link-local IPv6 Address". After going over several posts and using my imagination(which gets me in trouble with troubleshooting), I feel like in some config file in MySQL server dir is have to "bind the address" for the remote VM (which I access via putty from my laptop), am thinking along the right path?
As for the privileges for the root user in mysql server I believe I have given root every privilege (show below):
enter image description here
If you're going to use the RJDBC package, you have to stick with JDBC. ODBC might be "one letter off", but it's not the same thing.
You need a few things to be in place:
The database on your Windows machine has to be running, visible from the Linux machine, and have a JDBC driver JAR available that will let you connect to it. If you tell me your database is Microsoft Access, you're done. There are no free JDBC drivers for Access.
You have to have the JDBC driver JAR for your database on the Linux machine, in the CLASSPATH that R will use to find it.
You need a JDK installed on the Linux machine. I recommend that you install nothing older than version 8.
Once this is in place it should be easy. I've done it.
I solved my issue and can access MySQL sever on my laptop from remote ression(that I access with putty as follows:
in putty first used 3307 as source, checked the remote radio buttons, set destination to localhost:3306 and at Bash prompt in VM:
mysql -u root -p -h '127.0.0.1' -P 3307
Or from Linux (I use WSL) Bash prompt:
# access the remote VM from Windows Linux subsystem(WSL)
ssh -R 3307:localhost:3306 blsingh#149.165.169.21
## access MySQL server on my laptop from Bash prompt on in WSL
mysql -u root -p -h'127.0.0.1' -P 3307
From here its not difficult to figure out how to access it in R; we have a remote port forward and we use the same parameters in R.
☼
I have a strange issue on a web server (Windows Server 2012) with MySQL 5.7.16.
I can't connect anymore to mysql server, I don't know why.
If I type mysql -uroot -ppassword appear an error
ERROR 1130 <HY000>: Host '::1' is not allowed to connect to this MySQL server or
ERROR 1130 <HY000>: Host '127.0.0.1' is not allowed to connect to this MySQL server
I tried to use another user with all privileges and I've seen that in host there is only localhost (not 127.0.0.1 or ::1)
How can I login with root#localhost and not with root#127.0.0.1?
It's very frustrating...
Every account trying to use #127.0.0.1 or #::1 but there exist only localhost in host and I can't change it.
If I type mysql -uroot -ppassword I see
ERROR 1130 <HY000>: Host '127.0.0.1' is not allowed to connect to this MySQL server
Same if I type mysql -uroot -ppassword -h localhost or anything else
Ok i Fixed...
I've comment "skip_name_resolve" in my.ini and everything is back to work.. i really don't know why because this record was in my.ini also yesterday..last week.. last month..
The variable skip_name_resolve gives better performance because the server does not try to resolve the names of the connecting clients or look for them every time in the host name cache (even localhost is resolved/searched), but the manual states that config also limits the #localhost connections. The solution is to copy the #localhost users with #127.0.0.1, like this:
CREATE USER 'root'#'127.0.0.1' IDENTIFIED BY 'root-password';
CREATE USER 'root'#'::1' IDENTIFIED BY 'root-password';
FLUSH PRIVILEGES;
where ::1 is localhost for IPv6 addressing. This way we keep the root and local accounts limited to the local server. Using '%' open the potential clients to the world, and we don't want that. Disabling skip_name_resolve also requires the server having an accesible and fast DNS resolver to minimize latency.
I noted that I can connect with a local phpmyadmin even if the user has #localhost; this is because phpmyadmin connects thru a local unix socket, a special type of file used to communicate between processes, and does not need networking.
EDIT: As #Francisco R noted, the new root users also should have full access to all databases by issuing the following commands:
GRANT ALL PRIVILEGES ON *.* TO 'root'#'127.0.0.1'
GRANT ALL PRIVILEGES ON *.* TO 'root'#'::1'
FLUSH PRIVILEGES
I had the same message after a fresh installation with the no-install zip and solved it as follows. Perhaps this could have been a solution for your problem too:
Stop the MySQL server or service.
Open a Command Prompt window with administrative rights and go to the bin folder in the MySQL install directory.
Start MySQL with skip-grants-table and don't forget your config file:
mysqld --defaults-file=[filename] --skip-grant-tables
Open another Command Prompt window and go to the bin folder again.
Now you can login:
mysql -u root -p
Show the users with:
SELECT user, host FROM mysql.user;
Verify there is one 'root' with host 'localhost'.
Change the host:
UPDATE mysql.user SET host='%' WHERE user='root';
Exit the mysql program and close the Command Prompt window.
Type Ctrl-C in the other Command Prompt window to stop the server, then close the Command Prompt Window.
Start MySQL as you normally would and verify that you can login.
Make sure that when you created the user you have specified % as the hostname, otherwise the user will only be able to connect from the localhost.
I came here looking for a solution using Local by flywheel for wordpress development to the same problem, BUT, in a linux machine.
Just if someone faces the same problem, the solution listed here works.
Just comment skip_name_resolve in the file conf/mysql/my.cnf.hbs under the file tree created by Local
Thanks!
Looks that you need to modify your hosts file. C:\Windows\System32\Drivers\etc\hosts
just add the line and save it, (to be able to edit and save you may need to open it as administrator)
127.0.0.1 localhost
Using MySQL Workbench in Windows 7 how can I bind my MySQL Server to my IP Address instead of 127.0.0.1 and how can I give users from different hosts access to it?
From here:
Open a DOS command prompt on the server.
Run the following command from the mysql\bin directory:
mysql -u root --password=
A mysql prompt should be displayed.
To create a remote user account with root privileges, run the following commands:
GRANT ALL PRIVILEGES ON . TO 'USERNAME'#'IP' IDENTIFIED BY 'PASSWORD';
It depends on hosting server on which the database is hosted e.g. by Hostgator hosting you may bind IPs to access the database remotely, you will have to provide access to user IPs in the hosting. For other like Go Daddy it depends on while creating the database, you will have to select for remote database option which generated a url likewise a host with which database can be accessed with SQLYog/Workbench.
My Answer is you can't bound the IPs with database tools but only with hosting servers.
I've two machine.
Machine 1 (Server) : MySQL Server installed on it.
Machine 2 (Client) : MySQL Server not installed on it.
I would like connect from Machine 2 (Client) to MySQL Server on Machine 1 (Server).
I did following command on Machine 1 (Server) to grant permission to all clients :
GRANT ALL ON *.* TO root#'%' IDENTIFIED BY '123456';
Well, I need to connect MySQL Server from Client.
I've write below command in cmd on Machine 2 (Client) :
mysql -h 192.168.0.1 -u root -p
192.168.0.1 on above line is Machine 1 (Server) IP.
But following error has occur :
`mysql` is not recognaized as an internal or external command, operable program or batch file.
I guess need to install something like mysql connector or something else on Machine 2 (Client), isn't it ?
You can use other tool with good looking GUI. For example: HeidiSQL.
Then, you need to enable remote access. If you use windows, there is nice wizard for you to enable remote access with a few clicks. The wizard is located it at MySQL Server 5.5\bin\MySQLInstanceConfig.exe. Then
Reconfigure Instance -> Next -> Standard Configuration -> Next -> Next. You will see this screen.
Tick on "Enable root access from remote machines". Or you can manually configure it to allow remote access from my.ini file. See this link for how to do it.
If having done above still does not allow you to connect to your MySQL. Please make sure that Firewall does not block MySQL port.
I can give you an idea to do it,
1st: You have to give permission from machine 1 for machine 2. You should edit httpd.conf file
Listen machine 2 ip (192.168.0.*)
2nd: You have to give permission for phpmyadmin by following code-
GRANT ALL PRIVILEGES ON Database.* to 'username'#'ip or url' IDENTIFIED by 'password';
You can check # http://www.cyberciti.biz/faq/mysql-connection-from-other-machine/
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.