加拿大华人论坛 美国华人新闻What If You Forget Mysql Root Password
在加拿大
If you have set a root password, but forgot what it was, you can set a new password with the following procedure:1. Take down the mysqld server by sending a kill (not kill-9) to the mysqld server. The pid is stored in a `.pid' file, which is normally in the MySQL database directory:shell> kill `cat /mysql-data-directory/hostname.pid`You must be either the Unix root user or the same user mysqld runs as to do this.2. Restart mysqld with the --skip-grant-tables option.3. Set a new password with the mysqladmin password command:shell> mysqladmin -u root password 'mynewpassword'4. Now you can either stop mysqld and restart it normally, or just load the privilege tables with:shell> mysqladmin -h hostname flush-privileges5. After this, you should be able to connect using the new password.Alternatively, you can set the new password using the mysql client:1. Take down and restart mysqld with the --skip-grant-tables option as described above.2. Connect to the mysqld server with:shell> mysql -u root mysql3. Issue the following commands in the mysql client:mysql> UPDATE user SET Password=PASSWORD('mynewpassword') WHERE User='root';mysql> FLUSH PRIVILEGES;4. After this, you should be able to connect using the new password.5. You can now stop mysqld and restart it normally.
评论
1. Kill the server (kill -9 mysqld, you will probably need to log in as OSuser 'root').2. Start the server with the option skip-grant-tables, e. g.mysqld --skip-grant-tables.3. Connect to the server using MySQL Monitor, the command line tool: shell>mysql (You can connect without username/password.)4. On the SQL command line, do: GRANT ALL ON *.* TO 'superuser'@'localhost'IDENTIFIED BY 'iwillremember' WITH GRANT OPTION;5. Exit MySQL Monitor.6. On the shell, do: mysqladmin -usuperuser -piwillremember shutdown7. On the shell, do: mysqld (to start the server again)Now, this new 'superuser' can create accounts for regular users.
·加拿大新闻 61.5万元起售,提供两个配置级,潜在用户该怎么选这车?
·加拿大新闻 第六代丰田RAV4,还是美版好!
·加拿大新闻 NBA通知所有球队:开始进行审查识别可疑投注行为
·加拿大新闻 月销又过万,这车总能卖得好,多款车型在售,家用如何选
·加拿大新闻 独一份!兰博基尼入华20周年纪念款亮相,收藏党冲!
·汽车 “抓斗”雨刷片
·汽车 2018款沃尔沃V60








