ERROR 2005 (HY000): Unknown MySQL server host "danny#server" (1) - mysql

I am getting Error 2005 while trying to mysqldump from the remote mysql
mysqldump -u root -pXXX -h danny#server test > test_sep11.sql

Remove danny#. No need to specify a user, this is no ssh connection. The DNS lookup fails otherwise.
mysqldump -u root -pXXX -h server test > test_sep11.sql

Related

How to mysqlimport a local export to remote mysql server?

I have a local mysql dump that I want to copy-insert into a remote db:
mysqlimport --host=192.168.xxx.xxx --user=username --password=password remote_table /tmp/export.txt
Result:
mysqlimport: Error: 1290, The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
So how can I tell my remote mysql server to accept imports from remote machine?
i) take mysql dump as follows
mysqldump -u user -p db-name > db-name.out
ii) Copy db-name.out file using sftp/ssh to remote MySQL server:
scp db-name.out user#remote.box.com:/remoteBoxDirectory
iii)Restore database at remote server (login over ssh):
mysql -u user -p db-name < db-name.out
or
mysql -u user -p 'password' db-name < db-name.out

Mysql[MariaDB] - Unknow error 1130

I'm trying to connect to a database and I'm getting this error:
ERROR 1130 (HY000): Unknown error 1130
Here is a command which I'm using:
mysql --host HOSTNAME --user MYUSERNAME -p MYDATABASENAME
I'm using Arch Linux. Thanks in advance for the help !
mysql --host HOSTNAME --user MYUSERNAME -p MYDATABASENAME
MYDATABASENAME - Should be Password not DatabaseName..
Syntax:
shell> mysql --host=localhost --user=myname --password=password mydb
shell> mysql -h localhost -u myname -ppassword mydb
Ref: https://dev.mysql.com/doc/refman/5.7/en/connecting.html
ERROR 1130 translates into Host '<hostname/IP>' is not allowed to connect to this MariaDB server, not sure why you see it as unknown error.
It means that there are no users configured with host=<your hostname/IP> on the server where you are connecting to -- that is, there is no user MYUSERNAME#<your hostname/IP>, or even <anything>#<your hostname/IP>, or <anything>#'%'.
Hi this is similar to phpMyAdmin Remote Access
Basically you have to first configure remote access. Here is a link for MariaDB on Arch Linux remote access configuration. https://dominicm.com/install-mysql-mariadb-on-arch-linux/
Edit config locally.
Config file sudo nano /etc/mysql/my.cnf
Grant privilege to table for user
GRANT ALL PRIVILEGES ON databasename.* TO 'dbusername'#'%' IDENTIFIED BY 'dbpassword';
Restart Mysql/MariaDB
Hopefully this helps.
try mysqld --skip-grant-table
Not sure why but it helped my teammate as she reported.
More details here. https://www.howtoforge.com/setting-changing-resetting-mysql-root-passwords

AWS EC2 Crontab auto backup RDS MySQL database

In my EC2 Linux, I would like to create a cron job to auto backup a MySql DB in AWS RDS. I had tried to run
/usr/bin/mysqldump -u dbusername -p'dbpassword' dbname > /path/backup.sql
but I got an error
"Warning: Using a password on the command line interface can be insecure.
mysqldump: Got error: 1045: Access denied for user 'dbusername'#'localhost' (using password: YES) when trying to connect".
What is wrong and how do I change the 'dbusername'#'localhost' to 'dbusername'#'xxx.xxxxxxxx.xx-xxxxxx-x.rds.amazonaws.com'?
I had also tried to write a MySql script to download backup.sh but unable to as it cannot go beyond
mysql -u 'dbusername' --password="dbpassword" -h 'xxx.xxxxxxxx.xx-xxxxxx-x.rds.amazonaws.com'
it is able to login but it shows the MySQL prompt
>
anything beyond that e.g.
> use db;
it will show
Warning: Using a password on the command line interface can be insecure.
mysqldump -u dbusername -p'dbpassword' -h hostname.here.com dbname > /path/backup.sql
The same -h works for all mysql* commands, e.g. if you want to connect to RDB:
mysqldump -u user -p'pass' -h db.us-east-1.rds.amazonaws.com dbname

Unknown MySQL server host amazon rds

I'm using linux command line to access amazon rds mysql, however, i keep getting the Unknown MySQL host error.
here is the command:
mysql -uxxx -pxxxx -hmydb.xxxx.us-west-2.rds.amazonaws.com:3306
I have added MySQL rule in the security group, but it still does not work.
Or try:
mysql -u xxx -p xxxx -h mydb.xxxx.us-west-2.rds.amazonaws.com --port=3306

php can connect to remote sql server but command line can't

I'm using exactly the same credentials to connect to a remote mysql server.
host % is given to the user.
I can connect via my php application on localhost to remote mysql server
however whenever i do command line on localhost
mysql -u username -p'password' -h remoteserver.domain.com
it throws an error
ERROR 1045 (28000): Access denied for user 'username'#'10.50.2.4' (using
password: YES)
what am i missing here?
Your mysql command line is wrong. Mysql has the funky syntax of:
mysql -u username -ppassword -h remoteserver.domain.com
instead of
mysql -u username -p password -h remoteserver.domain.com
Note the p tag and password placement.
turns out that i should do away single quotes in my password for windows-based mysql command
instead of
mysql -u username -p'password' -h remoteserver.domain.com
this actually works
mysql -u username -ppassword -h remoteserver.domain.com
reason why i use single quotes because my password contains non-alpha characters which works in linux but not on windows based command line