mysql5-client connects to mysql4-server - mysql

I installed mysql-5.1 into my server and mysql-4.1 has been installed already.
Then, I realized that I can connect from mysql-5.1 client to mysql-4.1 server like this.
[hoge#localhost:/usr/local/mysql5/bin]% ./mysql -u root -pXXXXXX -P 3306 -S /tmp/mysql4.sock
I can use select query to mysql-4.1 server. Is there any restriction in this case?
If there is a official document, please tell me.....
mysql5 has a perfect backward compatibility?

The one thing you have to worry about is what you're using to access your MySQL 4.1 database. When using PHP 5.3.0 with MySQL on the Microsoft Windows platform, I've hit a connection issue relating to the difference in password hashing between 4.1 and 5.1. See the official docs from MySQL on password hashing.

It's not fully backwards compatible. Read this document for the changes, in particular the ones marked Incompatible change.
Simple queries may work fine, but is much better to use the correct client for the server version (this goes double if you are accessing the server programmatically)

Related

MySql server not showing proper databases from Ubuntu server

I'm using wsl2 on a windows machine. I want to view my databases that I have on mysql server ubuntu in a GUI such as mysql workbench (on windows) but it seems as the two are not linked. In the pictures provided you can see that when I login to root, it displays different databases, I also use different passwords for root on both servers. When I try to use the root password from the ubuntu server in workbench, I get the error that I cannot connect to the database server.
Ubuntu databases
MySql workbench databases
MySql workbench config
MySql workbench error
UPDATE 2022
I found myself in this same need, and found a good resource that tackles this issue rather nicely. The solution itself predates even this question, funnily enough.
Long story short, check the following GitHub repository. Instructions are available and I can confirm it works on Windows 10.0.19041.1415 and WSL2.
https://github.com/shayne/go-wsl2-host
========================================================
WSL doesn't use the same IP as Windows, meaning you can't access it using localhost. Also, WSL IP changes everytime you boot it, meaning that the credentials for the connection will work only once.
In the sister community SuperUser, this has been discussed and some workarounds are avaliable, but I can't tell if they will work specifically with MySQL Workbench, as they ofter require you to use PowerShell/CMD.
Please, refer to the following discussions, which also provide further sources on the topic (There is one in particular that might be useful if you are running Windows 10 Pro).
Make IP address of WSL2 static
localhost and 127.0.0.1 working but not ip address in wsl windows 10
There are several requests to allow us to set WSL IP statically, so we can register it as a host in Windows DNS Host file and use that alias instead of the IP while setting up a connection (or use the IP itself, since it would be static anyway), but it is not ready yet AFAIK.
After reading the answer from #Jetto, I thought you could create a batchfile like this:
#ECHO OFF
wsl export wsl=$(hostname -I); sed -i -e "s/172.[0-9]*.[0-9]*.[0-9]*/${wsl/ /}/g" /mnt/c/Users/*username*/AppData/Roaming/MySQL/Workbench/connections.xml
This will replace the ip-address to the current ip-address of your wsl instance (relying on the fact that is starts with 172.)
If you start MySQL Workbench after running this script, you should be able to connect to MySQL (or MariaDB) which is running in the WSL2 session.
Disclaimer: I am not responsible for the fact that you did not make a backup of the file connections.xml 😉
P.S. In case you wonder: Yes this instance on my computer uses port 3356. But 3306 should work too if you do not have a local MySQL running.

Access MySql with HeidiSql

I do project and I use MySql. I like HeidiSql interface and generally this, so I would like to connect to my local database. But I really feel and maybe I am dumb because whatever host name I put I have errors. Anyway when I type ##hostname in cmd I see my windows authentication username, which also does not work for me.
Mysql Workbench work properly...
Default authentication plugin for MySQL has been changed in recent versions. Not all client programs out there have added support for it yet. You can check if HeidiSQL has released any latest version which adds this support. If it is not, then only solution is to change default authentication plugin on MySQL server and recreate the user. It is described in below links.
https://www.heidisql.com/forum.php?t=24939
https://github.com/HeidiSQL/HeidiSQL/issues/163

How do I remotely access an SQL database?

This question has been edited for clarity...
Say I have a MySQL database, what are my options for performing queries from a remote computer and having access to the resulting data.
A convoluted solution I can think of is to have a web service that receives a query from a request and responds with an xml file of the results, but this seems like a bad way of doing it. What other options do I have of accessing a database remotely?
So, if you are going to write a Java application to connect to a MySQL database you have a few options:
use JDBC directly as described here: https://dev.mysql.com/doc/connector-j/5.1/en/connector-j-usagenotes-basic.html
Hibernate (http://docs.jboss.org/hibernate/orm/current/quickstart/html_single/) but that may be a little bit too complicated
Spring Data, here is a nice tutorial: https://spring.io/guides/gs/accessing-data-mysql/
JDBI (http://jdbi.org/) extremely simple ;)
There are 2 ways to do it.
1)
mysql -u {username} -p{password} -h {remote server ip} {DB name}
2)
In Windows :
-- Login to another system using putty or rdesktop
-- Access mysql database after login
In Linux:
-- ssh to another system using "ssh user#ip"
-- Access mysql database after login
You can follow this link for more details:
https://support.rackspace.com/how-to/mysql-connect-to-your-database-remotely/
https://dev.mysql.com/doc/refman/5.7/en/connecting.html
If you are using windows machine you can use MySQL Workbench and then you can just provide the details of the server where MySQL is hosted.
You can also use putty to do SSH if MySQL server is hosted in Linux.
Steps:
List item
SSH to the Server where MySQL server is hosted.
mysql -u root -pyourpassword.

MYSQL - Connect MYSQL Workbench to a MYSQL server on localhost

I know the question I am about to ask is a very stupid once but I am new to MYSQL so please bear with me. Want I want to do is create a database on my local machine and also access/manipulate it from their. I thought MYSQL WB was the all in one tool to do this i.e it will also allow me to create a database and also make a MYSQL server from which to access it. But I came to know the Workbench is just a front end and you need to have a some kind of a seperate MYSQL server module for it to access.
The problem is I can't seem to find any link for a simple a server module on the MYSQL download site.
http://dev.mysql.com/downloads/ .
It has one Cluster Server but I don't think this is what I am looking for. If anyone could provide a link to the MYSQL server module using which I could connect MYSQL Workbench on my local host, and the steps to connect them that would be great.
The one your looking for is named MySQL Community Edition. The current version is 5.6.14. Just select your platform (mac, linux or windows) and follow the installation guide.
If you wish to have php/mysql then you can download xampp. It includes all the necessary tools. Or if you wish to install it separately then follow this for Windows,
http://dev.mysql.com/downloads/installer/

Has anyone successfully connected to MySQL from Ruby?

I'm starting to get a bit desperate in my attempts to get a ruby script to connect to MySQL.
I've given up on DBI, as I just don't seem to be able to get it to work no matter what I do. I figured I might have more luck with just using mysql.rb from ruby-mysql. However, in using that I get the following error:
./mysql.rb:453:in `read': Client does not support authentication protocol requested by server; consider upgrading MySQL client (Mysql::Error)
I gather from googling that error message that this means my version of MySQL is too recent and doesn't support old-style passwords. I'm on a shared server and don't have root access, so I can't make the changes recommended to the MySQL config.
My version, btw, is:
mysql Ver 14.7 Distrib 4.1.22, for pc-linux-gnu (i686) using readline 4.3
Has anyone succeeded in getting ruby to connect to MySQL? I've been trying under Windows, since I have admin access on my Windows machine, but if there's a way to do it without root access on Linux, that'd be even better.
Sounds like you've run in to a MySQL quirk. Some time around version 5.0 they changed the format of connect passwords. It's an easy fix, though: http://dev.mysql.com/doc/refman/5.1/en/old-client.html
(Also, check out the Ruby Sequel gem, it lets you do some real fun stuff with all sorts of databases and without the overhead of ActiveRecord: http://sequel.rubyforge.org/documentation.html )
There is a good summary of how to do this here: http://rubylearning.com/satishtalim/ruby_activerecord_and_mysql.html
I haven't had any issues with connecting to MySQL from Ruby on my test machines.
You mention that you're using a shared hosting provider. If they have that old of a ruby-mysql version that it's not compatible with the new style passwords, perhaps their support staff can make the changes you need made to the user row(s) in MySQL.
What are you looking to do? I think it is possible to use the ActiveRecord component of Rails to establish a connection to MySQL. I'll see if i can find some documentation to back this up, and i'll update this answer.
link to ActiveRecord/MySQL integration
Update: to use ActiveRecord for the purpose are looking for, you will need to create the various model classes that represent the tables you are pulling data from, and specify their relationships. Once that is done, you will be able to do something like:
SomeModel.find(:all, :conditions => ['some_column = ?', some_value]
I've used this approach in the past to provide my Rails apps with access to WordPress data.
It may be that you're using an older version of mysql and need to upgrade it.