Forgot mysql root password [closed] - mysql

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I forgot mysql root password. How can I get it again? I am trying to use mysql -u root command but I am getting this error ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: NO)
how can I solve this problem?

Try with -p option; then it will prompt you for password. In your case, it's saying that you can't access with user root with no password.
mysql -u root -h localhost -p
In case, you have really forgot your password then take a look here on how to reset the same
How to Reset the Root Password (for 5.7 version)

Related

how to reset my root password in mysql docker image [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
I am using MySQL image with docker, so when I want to get inside the MySQL by this command
docker exec -it mysql_1 MySQL -u root -p"
I have got an error below
"ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: YES)
and it seems to me that I have forgotten the password
Any suggestion would be appreciated.
First access your mysql container with this command
docker exec -it mysql_1 bash
or
docker exec -it mysql bash
then follow those steps to reset your root password for your mysql
https://linuxconfig.org/how-to-reset-mysql-root-password-on-your-linux-server

Access MySQL databases with only root password [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
so I have a dilemma. I am taking over from another developer and there's a box to which I only have root access, and I need to download the MySQL database from it. So I root in, and type mysql in the command line and get:
Access denied for user 'root'#'localhost' (using password: NO)
Then, I try mysql --user=root --password={myrootpassword} and it says:
Access denied for user 'root'#'localhost' (using password: YES)
I have no other information than the root password. Obviously this should be enough; how do I access my databases? Is the solution to create a new MySQL username?
Stop the mysql daemon, and start it up again with the --skip-grant-tables option. Once it's started up, you'll be able to log in as root with no password. You can do everything with the databases, change passwords, all that.
Note, you and everyone else will be able to log in without a password. You'll probably want to block off port 3306 or take the machine off the internet altogether til you're done what you need to do.
Once you've gotten the data or changed passwords or whatever, stop the service again and restart it normally to reenable permissions.
MySQL root and server root are two different accounts. Even if you have server root access it won't necessarily mean its same as MySQL root. However with server root access you can change MySQL root password. Depending upon the administration panel installed on your server there can be many different ways to do that.
First login as root
su root;
You can then set password by
root paswd;
It will ask for password, u can set whichever u wish.
Then logout from their & login as root as Username

Can't log in to mysql server. (Error 1045) [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I added a new user using phpmyadmin, and I get an error, and I used SQL Query :
create database foo_db;
create user foo_user identified by 'foo_password';
grant all on foo_db.* to 'foo_user'#'%';
flush privileges;
but It dosen't works too.
the error messeges was
ERROR 1045 (28000): Access denied for user 'folderfile'#'localhost' (using password: YES) (mysql)
#1045 Cannot log in to the MySQL server (phpmyadmin)
I can't solve this problem, please help.
Try this:
CREATE USER 'testtt'#'localhost' IDENTIFIED BY '***';
GRANT ALL PRIVILEGES ON * . * TO 'testtt'#'localhost' IDENTIFIED BY '***' WITH
GRANT OPTION MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0
MAX_USER_CONNECTIONS 0 ;
GRANT ALL PRIVILEGES ON `test` . * TO 'testtt'#'localhost';
Can you login as root user?
if so, please try:
1、login as root user:
mysql -u root
2、use mysql
3、update user set password=NEWPASSWORD where user='folderfile' and host='localhost' ;
4 FLUSH PRIVILEGES;
Good luck!!
the problem is you haven't mentioned the host name while creating user
so try this to log into mysql
mysql -u foo_user -h localhost -p
Enter password: foo_password
it works no need to do any changes

Host is not allowed to connect to this mysql server when making a local connection [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
When I try to connect with putty I get 'host is not allowed to connect to this mysql server'. Why is that happening? Host and client are on my machine.
When I connect with the command line it connects.
You need to change how your configuration is set up.
Comment out the skip-networking section within your MySQL config: # skip-networking, if you have skip-networking it will discard any TCP/IP connection which is likely why your failing.
Once you have enabled your TCP/IP connections you will need to grant permission to your user to connect from other machines:
GRANT ALL PRIVILEGES ON *.* TO <username>#'%' IDENTIFIED BY '<password>';
This will let username connect from any machine to your database with the appropriate password.

Launching MySQL without a password [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I have installed MySQL. During the process of installation I was asked whether I want to determine a password for root user. Well, I entered a password.
Now I can access it through
mysql -u root -p
Well, it works.
The question is what will happen if I use just mysql command?
Well. This is what appears:
mysql>
I'm a bit confused. If I organize a password, how can I get access without entering it.
What privileges do I have in this case?
You are connected as ROOT (you can create,detele, alter,procedures,triggers,tables,configurations, users, Dbs, etc) , so you can do whatever you want. It's the same if you do:
mysql -u root -p
or
mysql -u root -p "my_root_pass"
(of course if you have one)
the mysql> just mean that you are connected to your database, however it's not recommended that use that user, also you should give him a password with the grant command.
if you want to see the user that you are using, you can use:
mysql> select current_user;
The fact that you can "enter" MySQL doesn't mean that you have the ability to do anything. Try and create a database without supplying a password. Try and access a database without the password... I'm fairly sure that you won't be able to do either.
Try to access your database / tables when you see mysql> If it doesn't give you an error, then your password most likely is still not set for the root account. If this is the case, you can go ahead and execute this query to set your root password.
grant all privileges on *.* to 'root'#'localhost' identified by 'your new password';