how to login mysql shell when mysql have no password
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
I got this error:
root@sys3026:/home/sys3026# mysql --user=root --password
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
Any one please help me.
Thanks in advance..
permissions login mysql
add a comment |
I got this error:
root@sys3026:/home/sys3026# mysql --user=root --password
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
Any one please help me.
Thanks in advance..
permissions login mysql
add a comment |
I got this error:
root@sys3026:/home/sys3026# mysql --user=root --password
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
Any one please help me.
Thanks in advance..
permissions login mysql
I got this error:
root@sys3026:/home/sys3026# mysql --user=root --password
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
Any one please help me.
Thanks in advance..
permissions login mysql
permissions login mysql
edited May 16 '17 at 5:14
muru
1
1
asked May 16 '17 at 4:49
veerakrishna pachhipalaveerakrishna pachhipala
112
112
add a comment |
add a comment |
4 Answers
4
active
oldest
votes
Try this.
This is the command to run mysql when no password is set, But If you just installed it and you did not set any password, I am pretty sure it still has a random password that can be found in logs located in /var/log/mysql
.
mysql -u root
add a comment |
If your database has no password, just leave out the --password
parameter.
$ mysql --user=root
Reference:
- https://stackoverflow.com/questions/3843973/mysql-is-prompting-for-password-even-though-my-password-is-empty
add a comment |
If you have forgotten your password or you can not login you can always run mysql in a "safe_mode". Which allows you to access it without any password restriction - to change the root password or adjust something else if something went wrong.
systemctl stop mysql
sudo mysqld_safe --skip-grant-tables &
Now you can access the mysql server without a password.
mysql -uroot
Add a new password to the root user in the mysql shell
use mysql;
update user set password=PASSWORD("newpassword") where User='root';
flush privileges;
Now restart it in normal mode again and it will work with the new password.
systemctl stop mysql
systemctl start mysql
add a comment |
When a MySQL user is configured to use auth_socket
(instead of mysql_native_password
), as it is by default in Ubuntu 18.04, you can log-in as root (for example) in the following way:
sudo mysql -u'root'
or just:
sudo mysql
References:
- Digital Ocean: How To Install MySQL on Ubuntu 18.04 - read Step 3
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f915585%2fhow-to-login-mysql-shell-when-mysql-have-no-password%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
Try this.
This is the command to run mysql when no password is set, But If you just installed it and you did not set any password, I am pretty sure it still has a random password that can be found in logs located in /var/log/mysql
.
mysql -u root
add a comment |
Try this.
This is the command to run mysql when no password is set, But If you just installed it and you did not set any password, I am pretty sure it still has a random password that can be found in logs located in /var/log/mysql
.
mysql -u root
add a comment |
Try this.
This is the command to run mysql when no password is set, But If you just installed it and you did not set any password, I am pretty sure it still has a random password that can be found in logs located in /var/log/mysql
.
mysql -u root
Try this.
This is the command to run mysql when no password is set, But If you just installed it and you did not set any password, I am pretty sure it still has a random password that can be found in logs located in /var/log/mysql
.
mysql -u root
answered May 16 '17 at 5:49
Ishan JainIshan Jain
1212
1212
add a comment |
add a comment |
If your database has no password, just leave out the --password
parameter.
$ mysql --user=root
Reference:
- https://stackoverflow.com/questions/3843973/mysql-is-prompting-for-password-even-though-my-password-is-empty
add a comment |
If your database has no password, just leave out the --password
parameter.
$ mysql --user=root
Reference:
- https://stackoverflow.com/questions/3843973/mysql-is-prompting-for-password-even-though-my-password-is-empty
add a comment |
If your database has no password, just leave out the --password
parameter.
$ mysql --user=root
Reference:
- https://stackoverflow.com/questions/3843973/mysql-is-prompting-for-password-even-though-my-password-is-empty
If your database has no password, just leave out the --password
parameter.
$ mysql --user=root
Reference:
- https://stackoverflow.com/questions/3843973/mysql-is-prompting-for-password-even-though-my-password-is-empty
edited May 23 '17 at 12:39
Community♦
1
1
answered May 16 '17 at 11:12
MelebiusMelebius
5,09352041
5,09352041
add a comment |
add a comment |
If you have forgotten your password or you can not login you can always run mysql in a "safe_mode". Which allows you to access it without any password restriction - to change the root password or adjust something else if something went wrong.
systemctl stop mysql
sudo mysqld_safe --skip-grant-tables &
Now you can access the mysql server without a password.
mysql -uroot
Add a new password to the root user in the mysql shell
use mysql;
update user set password=PASSWORD("newpassword") where User='root';
flush privileges;
Now restart it in normal mode again and it will work with the new password.
systemctl stop mysql
systemctl start mysql
add a comment |
If you have forgotten your password or you can not login you can always run mysql in a "safe_mode". Which allows you to access it without any password restriction - to change the root password or adjust something else if something went wrong.
systemctl stop mysql
sudo mysqld_safe --skip-grant-tables &
Now you can access the mysql server without a password.
mysql -uroot
Add a new password to the root user in the mysql shell
use mysql;
update user set password=PASSWORD("newpassword") where User='root';
flush privileges;
Now restart it in normal mode again and it will work with the new password.
systemctl stop mysql
systemctl start mysql
add a comment |
If you have forgotten your password or you can not login you can always run mysql in a "safe_mode". Which allows you to access it without any password restriction - to change the root password or adjust something else if something went wrong.
systemctl stop mysql
sudo mysqld_safe --skip-grant-tables &
Now you can access the mysql server without a password.
mysql -uroot
Add a new password to the root user in the mysql shell
use mysql;
update user set password=PASSWORD("newpassword") where User='root';
flush privileges;
Now restart it in normal mode again and it will work with the new password.
systemctl stop mysql
systemctl start mysql
If you have forgotten your password or you can not login you can always run mysql in a "safe_mode". Which allows you to access it without any password restriction - to change the root password or adjust something else if something went wrong.
systemctl stop mysql
sudo mysqld_safe --skip-grant-tables &
Now you can access the mysql server without a password.
mysql -uroot
Add a new password to the root user in the mysql shell
use mysql;
update user set password=PASSWORD("newpassword") where User='root';
flush privileges;
Now restart it in normal mode again and it will work with the new password.
systemctl stop mysql
systemctl start mysql
edited May 22 '18 at 3:40
fosslinux
2,39521837
2,39521837
answered May 16 '17 at 10:41
ZiazisZiazis
1,913419
1,913419
add a comment |
add a comment |
When a MySQL user is configured to use auth_socket
(instead of mysql_native_password
), as it is by default in Ubuntu 18.04, you can log-in as root (for example) in the following way:
sudo mysql -u'root'
or just:
sudo mysql
References:
- Digital Ocean: How To Install MySQL on Ubuntu 18.04 - read Step 3
add a comment |
When a MySQL user is configured to use auth_socket
(instead of mysql_native_password
), as it is by default in Ubuntu 18.04, you can log-in as root (for example) in the following way:
sudo mysql -u'root'
or just:
sudo mysql
References:
- Digital Ocean: How To Install MySQL on Ubuntu 18.04 - read Step 3
add a comment |
When a MySQL user is configured to use auth_socket
(instead of mysql_native_password
), as it is by default in Ubuntu 18.04, you can log-in as root (for example) in the following way:
sudo mysql -u'root'
or just:
sudo mysql
References:
- Digital Ocean: How To Install MySQL on Ubuntu 18.04 - read Step 3
When a MySQL user is configured to use auth_socket
(instead of mysql_native_password
), as it is by default in Ubuntu 18.04, you can log-in as root (for example) in the following way:
sudo mysql -u'root'
or just:
sudo mysql
References:
- Digital Ocean: How To Install MySQL on Ubuntu 18.04 - read Step 3
answered Mar 28 at 19:45
pa4080pa4080
14.8k52873
14.8k52873
add a comment |
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f915585%2fhow-to-login-mysql-shell-when-mysql-have-no-password%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown