Linux installed on the Mysql database, but found that the password forgotten, sad, and the solution with the window system, regardless of which operating system processing ideas are the same, is the first to remove the permissions of MySQL, so even if you forget the password, do not use the password, you can enter,
But Windows and Linux are slightly different in shielding MySQL permissions; This method is suitable for forgetting passwords, or just starting to install MySQL, there is no password, need to set a password situation; Online check-in using: mysqladmin-u root-p password 123 456 can modify this is the error after I executed: ' Access denied; Need (at least one's) the SUPER privilege (s) for this operation ' start resolution;
Enter the Linux operator interface:
1. Turn off MySQL
# Service Mysqld Stop
2. Blocking permissions
Modify the MySQL login settings to enter the default installation path for MySQL under Linux and locate the My.cnf file:
# VI/ETC/MY.CNF
--windows System is My.ini file
--Add a sentence in the [mysqld] paragraph: skip-grant-tables, if there is no [mysqld] field, you can add it manually
[Mysqld]
Datadir=/var/lib/mysql
Socket=/var/lib/mysql/mysql.sock
Skip-name-resolve
Skip-grant-tables (This is the one I added)
Here is my profile which just adds a word: skip-grant-tables
# Example MySQL config file forMedium systems.## this is forA system with little memory (32m-64m)whereMySQL plays# An important part, or systems up to 128MwhereMysql isused together with# other programs (such asa Web server) # # MySQL Programs look forOption filesinchASetof# locations which depend on the deployment platform.# you can copy Thisoption file to one of those# locations. For information about these locations, see:# http://dev.mysql.com/doc/mysql/en/option-files.html# in ThisFile, you can use allLongoptions A program supports.# If you want to know which options a program supports, run the program# with the "--help"option.# The following options would be passed to all MySQL Clients[client] #password=Your_passwordport=3306Socket=/tmp/mysql.sock# here follows entries forsome specific programs# the MySQL server[mysqld]port=3306Socket=/tmp/Mysql.sockskip-external-Lockinglog-error=/alidata/log/mysql/error.logkey_buffer_size=16mmax_allowed_packet=1mtable_open_cache= -sort_buffer_size=512knet_buffer_length=8kread_buffer_size=256kread_rnd_buffer_size=512kmyisam_sort_buffer_size=8Mskip-grant-tables# Don'T listen on a TCP/IP port at all. This can is a security enhancement,#ifAll processes, need to connect to mysqld run, the same host.# all interaction with mysqld must is made via Unix Sockets or named pipes.# Note thatusing Thisoption without enabling Named Pipes on windows# (via the"Enable-named-pipe"option) would render mysqld useless!# #skip-networking# Replication Master Server (default) # Binary Logging isRequired forReplicationlog-bin=mysql-bin# binary Logging format-Mixed Recommendedbinlog_format=mixed# required Unique ID between1and2^ +-1# defaults to1 ifMaster-host isNotSet# but would not function asA masterifOmittedserver-id =1# Replication Slave (Comment outMaster section to use This) # # to configure ThisHost asa replication slave, you can choose between# the methods: # #1The Change MASTER to command (fully describedinchOur manual)-# The syntax is: # # change MASTER to Master_host=, # Master_user=<user>, master_password=<password> ;## whereYou replace by quoted strings and#<port> by the Master's port number (3306 by default).# # example:## Change MASTER to Master_host='125.564.12.1', master_port=3306, # Master_user='Joe', master_password='Secret'; # # or##2) Set the variables below. However,inch CaseYou choose Thismethod, then# start Replication forThe first time (even unsuccessfully, forexample#ifYou mistyped the passwordinchmaster-Password and the slave fails to# connect), the slave would create a master.info file, and any later# change inch ThisFile to the variables'values below 'll be ignored and# Overridden by the content of the Master.info file, unless you shutdown# the slave server, delete Master.info a nd Restart the slaver server.# for this reason, you could want to leave the lines below untouched# (commented) and INS Tead use change MASTER to (see above) # # required Unique ID between2and2^ +-1# (and different fromThe Master) # defaults to2 ifMaster-host is Set# but would not function asA SlaveifOmitted#server-id =2# # The replication Master for ThisSlave-Required#master-host = # # The username the slave would use forauthentication when connecting# to the master-Required#master-user = <username># # The password the slave would authenticate with when connecting to# the master-Required#master-password = <password># # The Port the master isListening on.# Optional-Defaults to3306#master-port = <port># # Binary Logging-Not required forslaves, but Recommended#log-bin=mysql-bin# Uncomment the followingifYou areusingInnoDB Tables#innodb_data_home_dir=/usr/local/mysql/Data#innodb_data_file_path=Ibdata1:10m:autoextend#innodb_log_group_home_dir=/usr/local/mysql/data# You canSet.. _buffer_pool_size up to -- the%# of RAM but beware of setting memory usage too high#innodb_buffer_pool_size=16m#innodb_additional_mem_pool_size=2m# Set: _log_file_size to -%of buffer pool Size#innodb_log_file_size=5m#innodb_log_buffer_size=8m#innodb_flush_log_at_trx_commit=1#innodb_lock_wait_timeout= -[Mysqldump]quickmax_allowed_packet=16m[mysql]no-auto-rehash# Remove The next comment characterifYou is not a familiar with Sql#safe-updates[myisamchk]key_buffer_size=20msort_buffer_size=20mread_buffer=2mwrite_buffer=2m[mysqlhotcopy]interactive-timeout
my.cnf
(3) Open MySQL Service
# service mysqld start;
(4)
[[email protected] ~]# MySQL
mysql> use MySQL;
mysql> Update user Set Password=password (' New_password ') where user= ' root ';
mysql> flush Privileges;
MySQL >exit;
So we've changed the password,
(5) After you have changed your password, you need to restore your permissions: Remove the skip-grant-tables from the/ETC/MY.CNF
Then execute # service mysqld restart;
(6) then Mysql-u root-p
Enter Password: your new password;
It can be;
MYsql Database Password Forgotten (Linux)