mysql 修改密码和设置允许远程登录_MySQL

WBOY
Release: 2016-06-01 12:59:29
Original
1212 people have browsed it

修改的用户都以root为列。

一、拥有原来的myql的root的密码;

方法一:

在mysql系统外,使用mysqladmin

# mysqladmin -u root -p password "test123" Enter password: 【输入原来的密码】
Copy after login

方法二:
通过登录mysql系统,

# mysql -uroot -p Enter password: 【输入原来的密码】 mysql>use mysql; mysql> update user set password=passworD("test") where user='root'; mysql> flush privileges; mysql> exit;
Copy after login

二、忘记原来的myql的root的密码;

首先,你必须要有操作系统的root权限了。要是连系统的root权限都没有的话,先考虑root系统再走下面的步骤。
类似于安全模式登录系统,有人建议说是pkill mysql,但是我不建议哈。因为当你执行了这个命令后,会导致这样的状况:

/etc/init.d/mysqld status mysqld dead but subsys locked
Copy after login

这样即使你是在安全模式下启动mysql都未必会有用的,所以一般是这样/etc/init.d/mysqld stop,如果你不幸先用了pkill,那么就start一下再stop咯。

# mysqld_safe --skip-grant-tables &
Copy after login

以上所述就是本文的全部内容了,希望大家能够喜欢。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!