Mysql[MariaDB] - Unknow error 1130 - mysql

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

Related

mysql access denied for user ERROR 1045

I'm trying to user mysql on my machine, but I can't access the program.
I added configuration using mysql_config_editor as such:
mysql_config_editor set --login-path=client --user=root -p --host=localhost
and when i do a print i get:
[client]
user = root
password = *****
host = localhost
But when I try to connect to mysql, I get the following error
#mysql -u root -p
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using passowd: YES)
And when I try to connect like this, i get:
#mysql -u root -p -h127.0.0.1
ERROR 1130 (HY000): Host 'localhost' is not allowed to this MYSQL server
Every other answer I found was to do a SQL command. But i can't get inside the shell to do it.
Thanks
Have you already tried using the --skip-grant-tables option? If you have, and it doesn't allow you to access the mysql shell, go into your mysql installation folder and open my.ini file (my.cnf for most Linux distros). Inside it you'll find a mysqld tag, add skip-grant-tables underneath it and restart your mysql server. You'll be able to access your shell and therefrom edit the rights/privileges.

access denied mysql monitor

I installed xampp on 10.9 mavericks. Unfortunately the command mysql does not work in the terminal. I managed to start the mysql monitor from xamppfiles/bin/. When I try to create a new database I get
ERROR 1044 (42000): Access denied for user ''#'localhost' to database XY
What can I do?
No, you should run mysql -u root -p in bash, not at the MySQL command-line. If you are in mysql, you can exit by typing exit.
You may need to set up a root account for your MySQL database:
In the terminal type:
mysqladmin -u root password 'root password goes here'
And then to invoke the MySQL client:
mysql -h localhost -u root -p

How to do "mysqladmin flush-hosts" on server?

I have a hosting account, on database section i have "MySQL® Databases",
"MySQL® Database Wizard","phpMyAdmin" and "Remote MySQL" Options
Error i am getting is
Database ErrorHost 'adonis.havehost.com' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'
Write a server application that sends the query:
FLUSH HOSTS
to MySQL.
If you have shell access to the server, you can login and do:
mysql -u root -p -e 'flush hosts'
This must solve your issue.
mysql -u root -p -e 'flush hosts'
mysql -u root -p -e 'flush hosts'
And you can even contract your server provider
In MySql,run the following query:
FLUSH HOSTS;
Using mysqladmin you can execute this command:
mysqladmin flush-hosts;
and
mysqladmin flush-status;
This will remove the error shown by your MySQL server.
log in to your server by putty SSH, and just type this command
mysql -u root -p -e 'flush hosts'
and enter your root password after that your host name will be flushed , with out showing any massage in Shell.

Access mysql remote database from command line

I have a server with Rackspace. I want to access the database from my local machine command line.
I tried like:
mysql -u username -h my.application.com -ppassword
But it gives an error:
ERROR 2003 (HY000):
Can't connect to MySQL server on 'my.application.com' (10061)
What causes this error and how can I connect to the remote database?
To directly login to a remote mysql console, use the below command:
mysql -u {username} -p'{password}' \
-h {remote server ip or name} -P {port} \
-D {DB name}
For example
mysql -u root -p'root' \
-h 127.0.0.1 -P 3306 \
-D local
no space after -p as specified in the Using Options on the Command Line documentation
It will take you to the mysql console directly by switching to the mentioned database.
simply put this on terminal at ubuntu:
mysql -u username -h host -p
Now hit enter
terminal will ask you password, enter the password and you are into database server
edit my.cnf file:
vi /etc/my.cnf:
make sure that:
bind-address=YOUR-SERVER-IP
and if you have the line:
skip-networking
make sure to comment it:
#skip-networking
don't forget to restart:
/etc/init.d/mysqld restart
For Mac, use the following command:
mysql -u app -h hostaddress -P port -D dbname -p
and then enter the password when prompted.
If you want to not use ssh tunnel, in my.cnf or mysqld.cnf you must change 127.0.0.1 with your local ip address (192.168.1.100) in order to have access over the Lan. example bellow:
sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf
Search for bind-address in my.cnf or mysqld.cnf
bind-address = 127.0.0.1
and change 127.0.0.1 to 192.168.1.100 ( local ip address )
bind-address = 192.168.1.100
To apply the change you made, must restart mysql server using next command.
sudo /etc/init.d/mysql restart
Modify user root for lan acces ( run the query's bellow in remote server that you want to have access )
root#192.168.1.100:~$ mysql -u root -p
..
CREATE USER 'root'#'%' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'root'#'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;
If you want to have access only from specific ip address , change 'root'#'%' to 'root'#'( ip address or hostname)'
CREATE USER 'root'#'192.168.1.100' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'root'#'192.168.1.100' WITH GRANT OPTION;
FLUSH PRIVILEGES;
Then you can connect:
nobus#xray:~$ mysql -h 192.168.1.100 -u root -p
tested on ubuntu 18.04 server
Try this command mysql -uuser -hhostname -PPORT -ppassword.
I faced a similar situation and later when mysql port for host was entered with the command, it was solved.
try telnet 3306. If it doesn't open connection, either there is a firewall setting or the server isn't listening (or doesn't work).
run netstat -an on server to see if server is up.
It's possible that you don't allow remote connections.
For more details see:
How Do I Enable Remote Access To MySQL Database Server?
I assume you have MySQL installed on your machine. Execute the command below after filling missing details:
mysql -uUSERNAME -pPASSWORD -hHOSTNAME -P3306
mysql servers are usually configured to listen only to localhost (127.0.0.1), where they are used by web applications.
If that is your case but you have SSH access to your server, you can create an ssh tunnel and connect through that.
On your local machine, create the tunnel.
ssh -L 3307:127.0.0.1:3306 -N $user#$remote_host
(this example uses local port 3307, in case you also have mysql running on your local machine and using the standard port 3306)
Now you should be ale to connect with
mysql -u $user -p -h 127.0.0.1 -P 3307
There is simple command.
mysql -h {hostip} -P {port} -u {username} -p {database}
Example
mysql -h 192.16.16.2 -P 45012 -u rockbook -p rockbookdb
you can use the following code to connect to a remote MY SQL database
mysql -u {database_user} -p{db_password} -h {host_name} -P {port_number}
mysql -u admin -p'your_password' -h your-company.aws.com -P 3306
Must check whether incoming access to port 3306 is block or not by the firewall.
this solution worked for me:
On your remote machine (example: 295.13.12.53) has access to your target remote machine (which runs mysql server)
ssh -f -L 295.13.12.53:3306:10.18.81.36:3306 user#295.13.12.53
Explained:
ssh -f -L your_ssh_mashine_ipaddress:your_ssh_mashine_local_port:target_ipaddress:target_port user#your_ip_address -N
your_ssh_mashine_ipaddress - it is not local ip address, it is ip address
that you ssh to, in this example 295.13.12.53
your_ssh_mashine_local_port -this is custom port not 22, in this example it is 3306.
target_ipaddress - ip of the machine that you trying to dump DB.
target_port - 3306 this is real port for MySQL server.
user#your_ip_address - this is ssh credentials for the ssh mashine that you connect
Once all this done then go back to your machine and do this:
mysqldump -h 295.13.12.53 -P 3306 -u username -p db_name > dumped_db.sql
Will ask for password, put your password and you are connected.
Hope this helps.
Try this, Its working:
mysql -h {hostname} -u{username} -p{password} -N -e "{query to execute}"
This one worked for me in mysql 8, replace hostname with your hostname and port_number with your port_number, you can also change your mysql_user if he is not root
mysql --host=host_name --port=port_number -u root -p
Further Information Here
You should put your password with 'p'
mysql -u root -u 1.1.1.1 -p'MyPass'
I was too getting the same error.
But found it useful by creating new mysql user on remote mysql server ans then connect. Run following command on remote server:
CREATE USER 'openvani'#'localhost' IDENTIFIED BY 'some_pass';
GRANT ALL PRIVILEGES ON *.* TO 'openvani'#'localhost WITH GRANT
OPTION;
CREATE USER 'openvani'#'%' IDENTIFIED BY 'some_pass';
GRANT ALL PRIVILEGES ON *.* TO 'openvani'#'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;
Now you can connect with remote mysql with following command.
mysql -u openvani -h 'any ip address'-p
Here is the full post:
http://openvani.com/blog/connect-remotely-mysql-server/
If you are on windows, try Visual Studio Code with MySQL plugins, an easy and integrated way to access MySQL data on a windows machine. And the database tables listed and can execute any custom queries.
If port is default, some version required data base name which you trying to connect.
mysql -u <<your username>> -h <<your host>> <<your db name >> -p
This will prompt password Then type your password. If port is not default 3306
Then:
mysql -u <<your username>> -h <<your host>> -P <<your port>> <<your db name >> -p

remote server connect with mysql

I have mysql 5.1 set up and running.
I need to connect to:
location: comm.eng.bxg.com
name: amntxy
user: username
pswd: password
I have tried using
mysql -h amntxy -u username -p
Also tried: use amntxy and use comm.eng.bxg.com/amntxy
But I am unable to connect.
I get the following error:
ERROR 2005 (HY000): Unknown MySQL server host
I also tried mysql_connect but keep getting the error : mysql_connect is not recognized as internal or external command
But I do not understand hwo I can connect here.
Please help.
Thank you
mysql -h comm.eng.bxg.com -u username -p
After this it will ask for a password.
Optionally you can also directly specify the database name that you want:
mysql -h comm.eng.bxg.com -u username -p db_name
But again, this is 100% optional. You will be able to select or change it after with the command USE db_name.