This is my first time dealing with MySQL tables. I am taking a Linux system admin class in my college and I encountered a problem while following the lab.
When I do this command:
GRANT ALL ON alpha.* TO dbuser#10.10.0.6 IDENTIFIED BY 'CSCI480';
and later do:
mysql -udbuser -p -h 10.10.0.6
I get access denied message.
I would like to know what exactly is going on, why do I get those message. By the way, I am just following my Professor's Lab guide.
Followed lab
If it's on the localhost, just use:
GRANT ALL ON alpha.* TO dbuser#localhost IDENTIFIED BY 'CSCI480';
and
mysql -u dbuser -p
Edit:
I noticed you stated the error says "using password: NO". After the above command press Enter and it will ask you for a password, type: CSCI480. Is it prompting you for a password? What if you try:
mysql -u dbuser -pCSCI480
Related
I finally decided to post my question as I am encountering high difficulties to connect to the mysql client.
I am using a mySQL database on an OpenWRT OS installed on an Arduino Yun.
I cannot log into mySQL as root, the following error message is displayed:
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using
password: NO)
I tried with suffix -u root (or -uroot) and suffix -p and a supposed password but every time it turns out to be the same error, sometimes with (using password: NO), other times with (using password: YES)
Reading some posts, I tried all the following manipulation :
kill mysqld and then run
mysqld with --skip-grant-tables
It works and I can log into mysql but any operation proposed to UPDATE the password for user root turns a QUERY OK with 0 rows modified. It should be normal I suppose, as I am not log with grant tables I have no access to user informations and privileges.
Note that when I run
SELECT user();
or
SELECT current_user();
I get root# with nothing following.
Re-installing the databases using the script mysql_install_db. It does not work as is saying that no host "Arduino" or "localhost"could be looked up with /usr/bin/resolveip (nota: no such thing in that folder)
using the --force option it works.
I tried what is exposed in the following post SOLVED - MySQL - Can't Log In - Access Denied - Brand New Installation (OpenWRT)
With the command line
mysqladmin -uroot password pwd
I ended with the same answer :
error: 'Access denied for user 'root'#'localhost' (using password:
NO)'
Could anybody help me or tell me what is the cleanest way to uninstall and fully reinstall MySQL on OpenWRT?
Thank you
Well, yeah...
mysqladmin -uroot password pwd
^--missing --
Since you don't specify the password option correctly, you're effectively passing NO password to mysqladmin, and it doesn't log you in.
Try
mysqladmin -u root -p pwd
mysqladmin --user=root --password=pwd
instead.
So I am installing snort currently on my ubuntu linux server. I am following this guide here.
At this point, I am at the part in the guide where I am installing Barnyard2 and i need to access my SQL database to save information. linux server is near fresh install with little else on it. When I try to do this part of the guide:
echo "create database snort;" | mysql -u root -p
mysql -u root -p -D snort < ~/snort_src/barnyard2-master/schemas/create_mysql
echo "grant create, insert, select, delete, update on snort.* to \
snort#localhost identified by 'MYSQLSNORTPASSWORD'" | mysql -u root -p
When I run the first line - if I don't enter anything, I get the error message that says:
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: NO)
If I do enter something, I get a different error:
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: YES)
I have tried using this in order to reset my password but the command mysql -u root or any form of command similiar results back in the same error, even when it says the password is probably not required for this command. Does anyone know a way in which I can get this to work?
Why don't you break that down into chunks?
First make the database:
$ mysql -u root -p -e 'CREATE DATABASE `snort`'
Import the barnyard schema
$ mysql -u root -p < ~/snort_src/barnyard2-master/schemas/create_mysql
Now create the user & assign permissions for the snort db to the barnyard user
$ mysql -u root -p -e 'GRANT CREATE, INSERT, SELECT, DELETE, UPDATE ON `snort`.* TO snort#localhost IDENTIFIED BY '[SNORT PASSSWORD]'
The commands in your question are running a local mysql client which assumes to connect to a local database by default. If your database is running on a neighbouring Windows box you will need to rethink your parameters.
mysql -u root -p -h 192.168.0.99
Can’t figure this out, and all of my searching hasn’t helped.
When I login to mysql and I enter
$ mysql -u database_user -p
Enter password: ******* #here I enter my_password
this works. the next thing I see is the mysql> command prompt. However, if I enter
$ mysql -u database_user -pmy_password
or
$ mysql -u database_user --password=my_password
Both of which, according to the documentation, should be allow me access. I get the access denied response.
ERROR 1045 (28000): Access denied for user 'database_user'#'localhost' (using password: YES)
I've tried a lot of variations specifying database or host:
$ mysql -u database_user -pmy_password -d database_xxx -h localhost
But I keep getting the Access Denied error.
I want to pass my password as a command line argument so I can write some scripts to automate some tasks.
Has anyone else run into this issue or know why if I'm prompted for a password, I'm good, but if I pass it in as an argument, I cannot login.
Your password doesn't happen to have a '$' in it, like pa$$word? Or another character that might mean something to the shell?
In that case you will need to enclose your password with single quotes '
$ mysql -u database_user -p'my_password'
While I'm not sure exactly why you are having that problem, I strongly recommend against passing the password on the command line. The best practice is put the password in a secure file and use the --defaults-extra-file option. That way the password is not displayed in plaintext in the process table.
For your example, you could create a /etc/mysql_login.cnf file and permission it such that only you can read it, then put this in the file:
[client]
user=database_user
password=my_password
Then call the mysql cli like this:
mysql --defaults-extra-file=/etc/mysql_login.cnf
I am trying to connect Zapier to my Database. Zapier has very limited support for this and seem to be going round in circles.
I need to GRANT SELECT to a user on my database with this code;
GRANT SELECT ON my-database-here.my-table-here TO 'user-here'#'ip-address-here' IDENTIFIED BY 'my-password-here';
The error i receive is;
#1044 - Access denied for user 'xxx'#'localhost' to database 'xxxx'
The user has ALL PRIVILEGES but can't seem to get it to work. Any help here could be greatly received.
Thanks
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
you have 2 issues:
1 => mysql -uroot -p should be typed in bash (also known as your terminal) not in MySQL
command-line. You fix this error by typing.
exit
in your MySQL command-line. Now you are back in your bash/terminal command-line.
You have a syntax error:
mysql -uroot -p;
the semicolon in front of -p needs to go. The correct syntax is:
mysql -uroot -p
type the correct syntax in your bash commandline. Enter a password if you have one set up; else just hit the enter button. You should get a response that is similar to this:
When I try to connect to the sql server and enter the following in command prompt:
shell> mysql --user=username--password=password db_name
I get error:
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: Y
ES)
What does this error mean?
Looks like a space is missing between username and --password
If you don't know the root password, with Debian or Ubuntu, there is an easy way to reset it :
First, get the exact version of your server using
sudo dpkg --get-selections | grep 'mysql-server-'
Then, just use sudo dpkg-reconfigure mysql-server-5.x
(btw, replace 5.x with you real version number)
On a fresh install, the default root password is blank, so should be able to log in using just
mysql -u root
You should obviously add a root password after installation
mysqladmin -u root password [newpassword]
In most cases, you should also set up dedicated accounts with limited rights before working with a DB.
On Windows -
Search for services
Stop the service named MySQL[#] (in my case it was MySQL80).
Start the service again.
Open Command Prompt and type:
mysql [database name] -u [user name] -p
It worked for me when no other solutions worked. Hope this solves your issue as well.
It means your password is wrong or the account "root" has no access to the database on host "localhost".
Look at the right side bar. There are multiple questions equivalent to yours.