Open a Sequel Pro connection from command line - mysql

I have a database on a SaaS platform (Pantheon), and the connection string changes frequently (multiple times per day). This makes Sequel Pro favorites pretty useless.
I can easily fetch the new connection string from Terminal, and I can launch Sequel Pro from Terminal, but I can't figure out how to feed the connection string to Sequel Pro properly.
I've read through this thread, but just cannot figure out the proper syntax.
How can I make it work? Any other ideas about how to achieve similar?

Maybe you could write the changes to your Sequel Pro Favourites.plist -file and then start the program with --favorite (--favorite=site1 etc.) parameter.
Favourites.plist is normal text file in xml form and can be edited with a script etc.
In Mac OS X the favourites file is at ~/Library/Application Support/Sequel Pro/Data/Favourites.plist
This won't work if your password changes also as it's stored OS X Keychain. (Not sure where passwords are in Windows, sorry)

Related

How do I connect my Android Application to a MySQL database stored in a server?

Background on the MySQL database: it was created from a Wordpress website. As far as I know, it can only be accessed through PuTTy with the ff credentials given to me by my client who I’m making the app for:
hostname
port
my username to get into server
my password to
get into server
mysql username
mysql password
It says from multiple sites that this is the PHP syntax to connect Android to MySQL
// Connecting to mysql database
$con = mysql_connect(DB_SERVER, DB_USER, DB_PASSWORD) or die(mysql_error());
It does not work and when checked for the connection error, it shows the error “Connection timed out.” when I put credentials needed (hostname, mysql
username and password). I’m assuming it’s because I need to get into the server first (with credentials #3 and #4).
Is there a workaround to this?
EDIT:
This is only based on the assumption that I am supposed to create a PHP file (that I will place inside a Jave file in Android Studio) to connect to their database. Are there other ways to connect to a private server?
Welcome Ateshi!
It sounds like you want an android app to directly access the mysql database that holds the content of a wordpress website.
The MySQL database server is most likely not publicly available on the internet for good reasons (security), as per this answer
You have posted some PHP code. PHP usually runs on the server alongside mysql, it not usually run on android.
Here is how you usually set up something like this:
Your android app makes a web request to http://yourexampleserver.com/example.php
Inside that example.php which is on the server, you have the PHP code that then does:
connects to mysql (with local credentials)
perhaps writes to the database
perhaps queries the database
formats the results into a useful format like JSON
The results are returned to java on your android which then usually shows them in the UI etc
This whole process is usually described as building a "webservice" for the app to use.
If however, you want the database contents to be stored offline and locally on android, then you probably need to connect to the server manually, export the database and download it, and then include it in your android project.

QODBC connection string format

I am trying to learn about databases and my most current challenge is connecting from my iOS machine using qt5 into a database through the QODBC driver. After a bit of goggle-ing sure enough I found a bunch of threads on the subject and I now realise that in order to get rid of my
"QODBC3: Unable to connect" "[iODBC][Driver Manager]Data source name not found and no default driver specified. Driver could not be loaded"
error I must specify a connection string like such
db->setDatabaseName("Driver={SQL Server Native Client 11.0};Server=*<ip/host>*;Database=*<database>*;Uid=*<userid>*;Pwd=*<password>*;"
But I still can't make this work, because I am not sure what should I put as a Driver value. Where is this driver, or what if my database server is on another computer inside my Lan?
The QODBC driver adds a windows DSN. They are quite clever about preventing access from processes not running on the Quickbooks computer unless you buy their $499 server version.
I access the QODBC driver from within PHP command line, I first allow the odbc php module and use this in my PHP script:
$qb = odbc_connect("Quickbooks Data", "", "");
I did experiment with running a PHP script as a service, connected to a port which would then listen for incoming queries and reply with the result.
This worked, but ultimately we moved Quickbooks out of the workflow we use interacting with customers. Quickbooks is too unreliable for mission critical processes (example: taking money from customers); multiple times something would happen, Windows or UPS would update, and then our automated workflow for shuffling customer data and charging credit cards would fail.

How to open a new connection in mysql-workbench from the command line

I have used mysql-workbench on both Windows and Linux (Ubuntu) for a while now, and I find it's interface very comfortable, so when I needed a good GUI MySQL client to integrate with my code this was the obvious choice.
My MySQL connections parameters are saved in my server (IP, user, password) and I want to use these paremeters to open a mysql-workbench query window.
I read the command line arguments help (I use version 6.0) and it seems I can open a specific connection by it's name, but I want the code to be independent of my saved connections as I trust the connection info from my server more than one saved in mysql-workbench.
Is there an option to connect to an "anonymous" connection, or to create/manipulate connections from the shell (in either Windows or Linux)?
No, there's no such feature. Always use the connection name. If you want you can create a feature request at http://bugs.mysql.com to get attention for your wish.

MySQL Workbench: "Can't connect to MySQL server on 127.0.0.1' (10061)" error

I apologise.. I know this question has been asked many times before, but I've tried lots of suggestions, and simply can't find a solution.
The problem: I have a MySQL database running on a hosted server.
I have to use SSH to connect to it, and I have the relevant Public and Private Key files.
I specifically want to use the PC version of MySQL Workbench, to access this database, for running queries, checking data, etc.
If I run Sequel Pro on a Mac, it connects fine, and I can browse and query the database. No problems.
If I run the trial version of SQLyog on a PC, it also connects fine. No problems.
But if I try to connect use MySQL's own "MySQL Workbench" application, using exactly the same settings and SSH Private Key file, it refuses to connect, throwing the well-known error:
Can't connect to MySQL server on 127.0.0.1' (10061)
I find it frustrating, as, in SQL Workbench, I specified the "MySQL Hostname" to use, db01.mysql.vm.MyHostingServer.net, but Workbench seems to ignore it, and demand to connect to 127.0.0.1 instead.
(I have read that Workbench says it needs the Public key file, but actually means the Private key file... and I have tried with both. I've also tried with MySQL Workbench on a Mac, but that crashed all over the place, simply when I was typing in server names and passwords.. it was a mess !!)
The hosting service I've gone with gives me limited permissions for changing MySQL settings, and given that Sequel Pro and SQLyog can connect successfully, I don't want to start messing about and changing things randomly.
Any ideas...?
Maybe you are not allowed to start the service "MySQL 55". Set the login information of Service "MySQL 55" as local!
To see the list of aviable services in Windows 7:
Open a run box
Type services.msc and press return.
Find the service MySQL55
A right click of the MySQL55 Local Service shows Properties -> Log On
Even I had same problem, The reason was mysql service was not getting configured properly, when I installed it through 'MySQL installer'. Also it was not starting, when I tried to start the service manually.
So in my case it seemed be a Bug with the 'MySQL Installer', as editing the install path to a different one when the 'Developer default' was selected, the problem occurs.
Solution (Not exactly a solution):
Uninstalled the MySQL all products (completely)
Reinstalled, this time also I have selected 'Developer default', but didn't make any changes to the path or any thing. So the path was just 'C:\Program Files\MySQL' (the default one)
And just clicked Next Next...
Done, this time MySql was running fine.
After making above improvement such as checking if mysql service is running or not, you just need to give a small password while creating connection, it is ' ' or 1 time press on space-bar in case of GUI or workbench. After which you just need to validate your machine with server (validated HOST). For that purpose click on 'New Server Instance' and it will configure server/HOST on your behalf itself.
I have done this successfully just a few couple of minutes ago. My workbench software is able to show all pre-installed databases etc now.
hope it will work for you as well.
Thanks!!!
I was having same issue, way i have resolved is:
opened the MySQL installer. i was having a Reconfigure link on MYSQL Server row.
Clicked on it, it does reinstalled MySQL Server.
after that opened MySQL Workbench, and it was working fine.
Try placing the host name (db01.mysql.vm.MyHostingServer.net) in your windows host (C:\windows\system32\drivers\etc\host) file along with it's IP address and port number and see if that helps.
If you have installed WAMP on your machine, please make sure that it is running. Do not EXIT the WAMP from tray menu since it will stop the MySQL Server.
To connect to a new server, you click on home + add new connection. Put IP or webserver URL in new connection.
Just try to run the following command manually:
C:\wamp\bin\mysql\mysql5.6.17\bin\mysqld.exe --console
It worked for me :)
Ran into the exact same problem as OP and found that leaving the "MySQL Server Port" empty in the MySQL Workbench connection solves the issue.
I have tried all the method.
I will suggest you to reinstall it.

mysql console (windows->linux), wrong character set?

When I make a query from the mysql console and it has accents or any character that needs to be utf-8 encoded, it gets mugged
INSERT INTO users (userName) VALUES ("José Alarcón");
SELECT userName FROM users;
José Alarcón
SET NAMES utF8 changes nothing --default-character-set=utf8 as parameter changes nothing
Keep in mind than this is ONLY from the console. If I use phpmyadmin or make any query from a program, there is no problem at all, but an inserted row from the console gets muggled.
I'm using putty on windows as client
~$ locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
Clarification:
Mi local computer is windows XP, i'm using putty 0.60 as terminal client. The target system where MySQL is running is a Debian linux
I can't find any configuration in putty for character encoding...
Update: Stupid PuTTY, having the encoding configuration inside a menu called "translation" WTF?
Set PuTTY to interpret received data as UTF8 in Window -> Translation "Character set on received data".
Windows can't handle UTF8 in console and system messages (which putty uses). It wants to use your locale codepage. This is a common and known problem, and it's not solvable without rewriting cmd.exe, or using a different command line tool.
Microsoft have never really bothered about encodings outside their own world, which results in weird windows specific codesets.
Maybe you can change the putty encoding somewhere in its options so that it can at least communicate correctly to the mysql cli?
Your terminal client must be configured using UTF8. Your shell environment on the server must also be configured as UTF8. You can check it out with the following command.
locale
It depends on the distribution (I'm assuming you are using linux) how the system prefers how you fix the locale information if needed. For instance, Debian (and, I guess, Ubuntu) ask you to use the following command to reconfigure the locale settings.
dpkg-reconfigure locales
Notice; I'm not sure if they've changed this, haven't tested it in a while. :-)
You can of course set the locales in the shell each time you log in or in your profile. I recommend that you use the distribution's method to do it (if you need to do it after all :-)).