C
C
copal2015-12-09 18:43:46
MySQL
copal, 2015-12-09 18:43:46

How to change database permissions correctly?

Installed mysql from sudo (is that right?) and now I don't know how to allow user to connect to it.
What and how to do so that the user can interact with mysql?
UPD:
Not even that... I can connect if I write like below.
mysql -u user -p
If I want to connect to a specific database, as below, then an error appears.
mysql -u user -p some_db

ERROR 1044 (42000): Access denied for user 'user'@'localhost' to database 'some_db'

But if I go from sudo, then I get to connect to a specific database.
sudo mysql -u superuser -p some_db
But as I understand it, when creating a migration, you need to connect to the right database.
What to do?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Evgeniy Samoilenko, 2015-12-09
@copal

mysql> create database testbase; #create mysql database
> GRANT ALL PRIVILEGES ON testbase.* TO [email protected] IDENTIFIED BY 'pass'; #Give access to the user

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question