标签:mysql
a.
首先停止服务/etc/init.d/mysqld stop,在/etc/my.cnf中添加:
socket=/var/lib/mysql/mysql.sock
skip-grant-tables
user=mysql
启动mysql服务,输入mysql登陆
mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> update user set password=password (‘lixi‘) where user=‘root‘;
Query OK, 3 rows affected (0.02 sec)
Rows matched: 3 Changed: 3 Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
修改完后重启mysql然后在以自己修改的密码登陆就ok了
b.源码安装mysql及密码破解
root@192_168_2_193 ~]# cat /etc/issue
CentOS release 6.4 (Final)
Kernel \r on an \m
[root@192_168_2_193 ~]# uname -r
2.6.32-358.el6.x86_64
mysql下载wget http://downloads.mysql.com/archives/mysql-5.1/mysql-5.1.63.tar.gz
cp /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf
cp /usr/local/mysql/share/mysql/mysql.server /etc/rc.d/init.d/mysqld
chkconfig --add mysqld
chkconfig --level 35 mysqld on
/etc/init.d/mysqld restart
设置相关参数及初始化数据库
useradd mysql
chown -R mysql.mysql /usr/local/mysql
/usr/local/mysql/bin/mysql_install_db --user=mysql --datadir=./var
--basedir=/usr/local/mysql/
chown -R mysql.mysql var
/usr/local/mysql/bin/mysqld_safe --user=mysql &
/usr/local/mysql/bin/mysqld_safe --user=mysql --skip-grant-tables &跳过权限启动后台
/usr/local/mysql/bin/mysql 登陆 use mysql;update user set password=password(‘lixi‘) where user=‘root‘;flush privileges;/etc/init.d/mysqld restart
本文出自 “毛毛鸭” 博客,请务必保留此出处http://woshitieren.blog.51cto.com/2466034/1672546
标签:mysql
原文地址:http://woshitieren.blog.51cto.com/2466034/1672546