Showing posts with label root. Show all posts
Showing posts with label root. Show all posts

02 June 2024

Have forgotten root password of mysql server

$ sudo service mysql stop

$ sudo vi /etc/mysql/mysql.conf.d/reset-mysql-password.cnf

[mysqld] 
skip-grant-tables

$ sudo mysqld_safe --skip-grant-tables &

$ mysql -u root

mysql > UPDATE mysql.user SET authentication_string=null WHERE User='root'; 

mysql > FLUSH PRIVILEGES;

mysql > exit

$ mysql -u root

mysql > ALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'yourpasswd';

mysql > FLUSH PRIVILEGES;

sudo rm /etc/mysql/mysql.conf.d/reset-mysql-password.cnf

$ mysql -u root

mysql > 

05 June 2019

How to create a root password in Ubuntu Linux?

How to create a root password in Ubuntu Linux?


You may have noticed that you can’t login to root account on Ubuntu, this is because root doesn’t actually have a password set.
Type the following command:
sudo passwd
The following message will appear:
[sudo] password for [username]: [Type your user password and press return]
After that another message will appear, the following:
Type new UNIX password: [Type the root password you want]
Now the last thing you need to do, the following:
Retype new UNIX password: [Retype the root password you chosen before]
The following message will appear:
passwd: password updated successfully
If the above message showed up on your terminal, you can now use the root privileges by typing:
su
And then type the password you chosen. That's it!

06 February 2017

How to log in with root in Ubuntu?

How to log in with root in Ubuntu?

Simulate a root environment. If you are an advanced user who needs access to an actual root shell to run specific scripts, simulate a root shell with sudo –i. This command will give you superuser access with root’s environment variables.[3]
  • Enter the command sudo passwd root. This will create a password for root, essentially “enabling” the account. Don't forget this password.
  • Type sudo -i. Enter the root password when prompted.
  • The prompt will change from $ to #, indicating you have root access.

15 February 2013

How to reset password of mysql to none?

http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html

For Windows, use

mysql\bin>mysqld-nt --skip-grant-tables


C.5.4.1.3. Resetting the Root Password: Generic Instructions
The preceding sections provide password-resetting instructions for Windows and Unix systems. Alternatively, on any platform, you can set the new password using the mysql client (but this approach is less secure):
  1. Stop mysqld and restart it with the --skip-grant-tables option. This enables anyone to connect without a password and with all privileges. Because this is insecure, you might want to use --skip-grant-tables in conjunction with --skip-networking to prevent remote clients from connecting.
  2. Connect to the mysqld server with this command:
    shell> mysql
    
  3. Issue the following statements in the mysql client. Replace the password with the password that you want to use.
    mysql> UPDATE mysql.user SET authentication_string=PASSWORD('MyNewPass')
        ->                   WHERE User='root';
    mysql> FLUSH PRIVILEGES;
    
    The FLUSH statement tells the server to reload the grant tables into memory so that it notices the password change.
You should now be able to connect to the MySQL server as root using the new password. Stop the server, then restart it normally (without the --skip-grant-tables and --skip-networking options).

27 January 2011

How to log in as root in Ubuntu?

By default, you can not log in as root in Ubuntu, but you can mange to after you do the following:

$sudo passwd

and set a password for root.

$su

and type in the root password, then you are logged in as root.