时间:2021-07-01 10:21:17 帮助过:3人阅读
4、Linux下密码破解
- 1 [root@db01 mysql]<span># vim my.cnf
- 2 [mysql]
- 3 user=<span>root
- 4 password=123456
- 5 [mysqld]
- 6 skip-grant-tables<span> #在my.cnf文件中加上这句(跳过mysql授权表) <br> 7 <br> 8 [root@db01 mysql]# /etc/init.d/mysqld restart #重启MySQL服务 <br> 9 [root@db01 mysql]# mysql #登录MySQL <br>10 mysql> select user(); #查看登录用户是否为root <br>11 +--------+ <br>12 | user() | <br>13 +--------+ <br>14 | root@ | <br>15 +--------+ <br>16 1 row in set (0.00 sec)<br>17 <br>18 mysql> update mysql.user set password=password("123") where user="root" and host="localhost"; #修改密码为123 <br>19 mysql> flush privileges;</span></span></span>
- <em id="__mceDel"><br>注:windows下密码破解可以使用和Linux上相同的方法<br> windows下另外破解密码方法</em>
- 1 C:\Users\test>net stop mysql
- 2 C:\Users\test>mysqld --skip-grant-tables
- 3 C:\Users\test>mysql
- 4 mysql> update mysql.user set authentication_string=password(‘‘) where user = ‘root‘;
- 5 mysql> flush privileges;
- 6 C:\Users\test>net start mysql
5、指定登录用户名和密码和查看MySQL字符集
- 1 C:\Users\test>mysql -uroot -<span>p123456
- 2 mysql> select user<span>();
- 3 +----------------+
- 4 | user() |
- 5 +----------------+
- 6 | root@localhost |
- 7 +----------------+
- 8 1 row in set (0.00<span> sec)
- 9 mysql> show variables like ‘%char%‘<span>; #查看数据库字符集
- 10 +--------------------------+-------------------------------------------+
- 11 | Variable_name | Value |
- 12 +--------------------------+-------------------------------------------+
- 13 | character_set_client | utf8 |
- 14 | character_set_connection | utf8 |
- 15 | character_set_database | latin1 |
- 16 | character_set_filesystem | binary |
- 17 | character_set_results | utf8 |
- 18 | character_set_server | latin1 |
- 19 | character_set_system | utf8 |
- 20 | character_sets_dir | /application/mysql-5.6.35/share/charsets/ |
- 21 +--------------------------+-------------------------------------------+
- 22 8 rows in set (0.02 sec)</span></span></span></span>
6、mysql客户端免输入用名密码登录及修改默认字符集
在mysql配置文件中加上(windows上为my.ini,Linux上为my.cnf)
- [mysql]
- default-character-set=<span>utf8
- user=<span>root
- password=123456
- [mysqld]
- character-set-server=<span>utf8
- collation-server=<span>utf8_general_ci
- skip-grant-<span>tables
- C:\Users\Jun><span>mysql #登录MySQL
- mysql> select user<span>();
- +----------------+
- | user() |
- +----------------+
- | root@localhost |
- +----------------+
- 1 row in set (0.00 sec)</span></span></span></span></span></span></span>
MySQL安装及初始化
标签:share linux win app https 技术 登陆 ati mysqld