MySQL - problems with connecting to the database
I have had the problem with connecting to the local version of the database. Which is sort of a requirement, if I wanted to do any kind of development on the product main repository (but not my team main repository).
The error that I could see in the logs was:
Access denied for user 'squrb'@'localhost'
Now, based on the error, I assumed, that the problem is the user existence or permission. Since this is the local version of the database, I am perfectly fine to grant this user all permissions.
CREATE USER 'user'@'localhost' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON *.* TO 'user'@'localhost' WITH GRANT OPTION;
I am also happy to not have to deal with the permissions on the production database. I am sure, I would have screwed something up there.
Well, this did not work, so I have tried to see, what else could go wrong. I could not find the way log the database values when connecting, to see what am I even connecting to. The little that I could find told me, that we connect to a certain schema in the database.
And the name of my schema was different then the one that was expecting. Go figure. So I create the new schema with the expected name, and started importing the data back in. [Here is how to create a new schema(https://www.mysqltutorial.org/mysql-create-database/).
CREATE DATABASE IF NOT EXISTS database_name;
Well, this still did not work, even with grating permissions again. The next I figured out is, that if I want to see the users info, I needed to query the mysql.user
table. But the data there was not useful, simply because I did not understand, which permissions so I actually need.
On the end I went to MySQLWorkbench, and check the users and privileges part in the Administration. There I tried changing the password for the user, that we are using. And then it worked.
Not sure, what I did for this to become the problem, but I am glad, that I have figured it out.