当前位置:Gxlcms > 数据库问题 > MySQL安装及初始化

MySQL安装及初始化

时间:2021-07-01 10:21:17 帮助过:3人阅读

 

4、Linux下密码破解

  1. 1 [root@db01 mysql]<span># vim my.cnf
  2. 2 [mysql]
  3. 3 user=<span>root
  4. 4 password=123456
  5. 5 [mysqld]
  6. 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>
  1. <em id="__mceDel"><br>注:windows下密码破解可以使用和Linux上相同的方法<br> windows下另外破解密码方法</em>
  1. 1 C:\Users\test>net stop mysql
  2. 2 C:\Users\test>mysqld --skip-grant-tables
  3. 3 C:\Users\test>mysql
  4. 4 mysql> update mysql.user set authentication_string=password(‘‘) where user = ‘root‘;
  5. 5 mysql> flush privileges;
  6. 6 C:\Users\test>net start mysql

 

 

5、指定登录用户名和密码和查看MySQL字符集

  1. 1 C:\Users\test>mysql -uroot -<span>p123456
  2. 2 mysql> select user<span>();
  3. 3 +----------------+
  4. 4 | user() |
  5. 5 +----------------+
  6. 6 | root@localhost |
  7. 7 +----------------+
  8. 8 1 row in set (0.00<span> sec)
  9. 9 mysql> show variables like ‘%char%‘<span>; #查看数据库字符集
  10. 10 +--------------------------+-------------------------------------------+
  11. 11 | Variable_name | Value |
  12. 12 +--------------------------+-------------------------------------------+
  13. 13 | character_set_client | utf8 |
  14. 14 | character_set_connection | utf8 |
  15. 15 | character_set_database | latin1 |
  16. 16 | character_set_filesystem | binary |
  17. 17 | character_set_results | utf8 |
  18. 18 | character_set_server | latin1 |
  19. 19 | character_set_system | utf8 |
  20. 20 | character_sets_dir | /application/mysql-5.6.35/share/charsets/ |
  21. 21 +--------------------------+-------------------------------------------+
  22. 22 8 rows in set (0.02 sec)</span></span></span></span>

 

6、mysql客户端免输入用名密码登录及修改默认字符集

     在mysql配置文件中加上(windows上为my.ini,Linux上为my.cnf)

    技术分享图片

  1. [mysql]
  2. default-character-set=<span>utf8
  3. user=<span>root
  4. password=123456
  5. [mysqld]
  6. character-set-server=<span>utf8
  7. collation-server=<span>utf8_general_ci
  8. skip-grant-<span>tables
  9. C:\Users\Jun><span>mysql #登录MySQL
  10. mysql> select user<span>();
  11. +----------------+
  12. | user() |
  13. +----------------+
  14. | root@localhost |
  15. +----------------+
  16. 1 row in set (0.00 sec)</span></span></span></span></span></span></span>

 

MySQL安装及初始化

标签:share   linux   win   app   https   技术   登陆   ati   mysqld   

人气教程排行