Difference between revisions of "Resetting MySQL root password"
From Notes_Wiki
m |
m |
||
Line 5: | Line 5: | ||
#Stop mysql service if it is running. | #Stop mysql service if it is running. | ||
#Use command | #:<pre> | ||
# | #:: service mysqld stop | ||
#Use database mysql using | #:</pre> | ||
#Change root password | #Use below command to run mysql without any priviledge information | ||
#Stop mysql using command | #:<pre> | ||
#:: mysqld_safe --skip-grant-tables | |||
#:</pre> | |||
#Connect to mysql by without any options or authentication | |||
#:<pre> | |||
#:: mysql | |||
#:</pre> | |||
#Use database mysql using: | |||
#:<pre> | |||
#:: use mysql | |||
#:</pre> | |||
#Change root password using: | |||
#:<pre> | |||
#:: update user set password=password('secret') where user='root' | |||
#:</pre> | |||
#: or disable it using: | |||
#::<pre> | |||
#::: update user set password='' where user='root' | |||
#::</pre> | |||
#Stop mysql using command: | |||
#:<pre> | |||
#:: service mysqld stop | |||
#:</pre> | |||
#Start mysql again without any password or with the new password set. | #Start mysql again without any password or with the new password set. | ||
<yambe:breadcrumb self="Resetting MySQL root password">Mariadb configuration | Mariadb configuration</yambe:breadcrumb> |
Revision as of 05:06, 25 May 2021
<yambe:breadcrumb self="Resetting MySQL root password">Mariadb configuration | Mariadb configuration</yambe:breadcrumb>
Resetting mysql root password
In case we have root privileges on server and want to reset mysql root password then we can use following steps:
- Stop mysql service if it is running.
- service mysqld stop
- Use below command to run mysql without any priviledge information
- mysqld_safe --skip-grant-tables
- Connect to mysql by without any options or authentication
- mysql
- Use database mysql using:
- use mysql
- Change root password using:
- update user set password=password('secret') where user='root'
- or disable it using:
- update user set password='' where user='root'
- Stop mysql using command:
- service mysqld stop
- Start mysql again without any password or with the new password set.
<yambe:breadcrumb self="Resetting MySQL root password">Mariadb configuration | Mariadb configuration</yambe:breadcrumb>