mysqlherokucleardb

Can't add MySQL database to ClearDB, -u command not found


Doing the following, I am unable to import a MySQL database to ClearDB:

$mysql -u b4587523b48993 -h us-cdbr-iron-east-05.cleardb.net -p heroku_571df93b7623da9 < ./sql/sql_import.php

Whenever I try I get the error

-u: command not found

If I put sudo in front it says:

sudo: unknown user: b4587523b48993
sudo: unable to initialize policy plugin

Any ideas as to why this is happening?


Solution

  • Before doing anything else, please invalidate those connection credentials and generate new ones. They're forever compromised.

    The entire command you're running, from -u to the end, should be arguments to the mysql command. Your $mysql shell prompt may make it look like that's what you're doing, but it isn't.

    Add mysql to the beginning of your command (and adjust to account for your new credentials):

    $mysql mysql -u b4587523b48993 -h us-cdbr-iron-east-05.cleardb.net -p heroku_571df93b7623da9 < ./sql/sql_import.php
    

    As a side note, it's probably a good idea to lose the habit of prefixing sudo to commands that don't work. It's fine to do this in some situations, but it's important to recognise them. It shouldn't be your default troubleshooting action.