1. 首先停止正在运行的MySQL进程
Linux下,运行 killall -TERM mysqld
Windows下,如果写成服务的 可以运行:net stop mysql,如未加载为服务,可直接在进程管理器中进行关闭。
2. 启动MySQL
Linux下,运行 mysqld --skip-grant-tables --user=root
&
Windows下,在命令行下运行 X:/MySQL/bin/mysqld-nt.exe --skip-grant-tables
3. 完成以后就可以不用密码进入MySQL了
Linux下,运行 mysql -u root
进入
Windows下,运行 X:/MySQL/bin/mysql -u root 进入
4. 更改密码
>use mysql;
>update user set password=password('新密码') where user='root';
>flush privileges;
5. 用新密码登录
Linux下,运行 mysql -u root -p
输入密码
------------------------------------------------------------------------------------------
fedora install mysql: $sudo yum -y install mysql-server
start mysql: $ sudo service mysqld start
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h yfzhu.host password 'new-password'
Alternatively you can run:
/usr/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd /usr/mysql-test ; perl mysql-test-run.pl
-----------------------------------------------------------------------
A) If you are using mysql on RedHat Linux (Fedora Core/Cent OS)
then use following command:
To start mysql server:
/etc/init.d/mysqld start
* To stop mysql server:
/etc/init.d/mysqld stop
* To restart mysql server
/etc/init.d/mysqld restart
Tip: Redhat Linux also supports service command, which can be use to start, restart, stop any service:
# service mysqld start
# service mysqld stop
# service mysqld restart
(B) If you are using mysql on
Debian / Ubuntu
Linux then use following command:
* To start mysql server:
/etc/init.d/mysql start
* To stop mysql server:
/etc/init.d/mysql stop
* To restart mysql server
/etc/init.d/mysql restart
分享到:
相关推荐
修改Mysql的root密码方法,比较好用。希望能方便大家。
本文介绍了MySQL修改root密码的多种方法,忘记密码时,管理员可以在服务器上修改ROOT密码,防止忘记密码导致数据无法导出或使用工具连接数据库。
修改mysql root用户密码 修改mysql root用户密码 修改mysql root用户密码
修改Mysql的root用户密码 修改Mysql的root用户密码 修改Mysql的root用户密码
新装MySQL不知道密码,忘记MySQL密码,都可以安装该方法改过来,在Ubuntu和CentOS上用过多次。
整理了以下四种在MySQL中修改root密码的方法
主要介绍了修改Mysql root密码的方法的相关资料,非常不错,具有参考借鉴价值,需要的朋友可以参考下
本文给大家分享了三种方法来解决mysql修改root密码的方法,非常不错,具有参考借鉴价值,需要的朋友参考下吧
centeos5.5下编译安装MYSQL以及安装过程中遇到的问题解决方法,修改root密码
mysql修改root密码的四种方法 本文以windows为例为大家详细介绍下MySQL修改root密码的4种方法,大家可以可以根据的自己的情况自由选择,希望对大家有所帮助
mysql忘记超级管理员root密码之后,需要重置密码时请看过来,在文件中可以比较清晰的明白修改的过程,注:这是windows操作系统下的mysql root重置密码的过程
主要介绍了MySQL 如何修改root用户的密码,帮助大家更好的使用MySQL,不用担心忘记密码,感兴趣的朋友可以了解下
mysql给root开启远程访问权限,修改root密码
部署环境: 安装版本red hat Cent 7.0 MYSQL 版本 8.0.2.0 成功部署完毕后出现故障情况: ...后进去刷新权限表,重启服务,不用密码的root进去,在改root密码后,重新刷新权限表。方法试了很多个都不
mysql5.6zip版安装和修改root密码
修改root密码是需要重启mysql库,确认生产真的可以重启mysql库; 确认生产是否有直接使用root用户连接到库的使用情况,如果有则要做相应连带变更; 修改密码前请停掉连接到库的应用,也就是停掉该库相关的所有生产...
如何修改mysql_root密码的文档参考!
我们在使用Linux下搭建数据库往往会设置很繁琐忘记密码 接下教大家如何不需要密码修改
本文通过简洁的七步来设置MySQL 5.0数据库的root密码。
例子:mysql> set password for root@localhost = password(‘123’); mysql5.7和mysql8.0以上都可以用 方法2:用mysqladmin 格式:mysqladmin -u用户名 -p password 新密码 例子:mysqladmin -uroot -p ...