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
Related
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:
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
I am trying to get started with the following github package: py-gameday.
I installed mysql with brew mysql and created a root password:
> mysqladmin -u root password 'xxx'
I then created a user:
> mysql -uroot -p
Enter password: xxx
CREATE USER 'josh'#'localhost' IDENTIFIED BY 'yyy';
and just in case, I reset the password again:
SET PASSWORD FOR 'josh'#'localhost' = PASSWORD('yyy');
and grant permissions:
GRANT ALL ON gameday.* TO 'josh'#'localhost';
and I then updated mydb.ini with:
[db]
user=josh
password=yyy
db=gameday
I finally tried running the following:
$ mysql -D gameday < gameday.sql -p
Enter password: yyy
ERROR 1049 (42000): Unknown database 'gameday'
Why doesn't it work? I have a gameday.sql sitting there on the directory.
You need to physically create the database in mysql. Currently the gameday.sql is just a set of commands to run in the mysql database which probably creates a bunch of tables.
You'll need to use CREATE DATABASE gameday; in mysql, then give josh permissions to write to that database. Then the mysql -D -p gameday < gameday.sql -p command should work.
I am trying to get a local snapshot of a database by running this command:
mysqldump --single-transaction --quick -u user -ppass -h somehost db_name | mysql -u user -ppass -h localhost db_name
Even though this has worked for me in the past, I am now getting this error back:
error: 1045: Access denied for user 'user'#'123.10.123.123' (using password: NO) when trying to connect
I can successfully log in with the username and password above:
mysql -u user -ppass -h localhost
and I have previously granted privileges to the user for the local database, e.g.
grant all on db_name.* to user;
I also find it strange that the error message is returning user#my_ip_address instead of user#localhost when I have specified localhost as the host. I'm also confused as to why it says using password: NO, as I've also provided a password.
It turns out that the remote host that I was attempting to download from had changed. Using the correct new hostname solved the problem.
I exported all databases of a MySQL server by:
mysqldump -u root -p --all-databases > /tmp/dbs.sql
Then I copied the file (by scp) on another server, which has the same MySQL version, and imported it with:
mysql -u root -p < dbs.sql
I can access to MySQL only as root. With other users, I obtain:
~$ mysql -u jag -p
Enter password:
ERROR 1045 (28000): Access denied for user 'jag'#'localhost' (using password: YES)
However, selecting all users in mysql.user table, I can see that all user accounts where imported. So, how can I overcome this problem, without resetting all user passwords?
You need to specify username and password, you can try this:
mysql -u USERNAME -pPASSWORD -h HOSTNAMEORIP DATABASENAME
Note that there is no space between -p parameter and password!
You can check this: http://dev.mysql.com/doc/refman/5.0/en/connecting.html
After following all the similar answers for this issue, I've solved it in CentOS with this:
http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html
please make sure to grant privileges to that user u want to restore with, in this case 'jag'