在小皮面板中使用cmd进入mysql命令,包含mysql错误unknown variable 'secure_file_priv’解决方法(超详细)

  1. 先按win+r键打开运行对话框,输入cmd,进入:

在这里插入图片描述

  1. 在第一行输入: d:
    在这里插入图片描述
  2. 紧接着在后面输入:你所使用mysql的位置(精确到bin的位置)
    例如:我的是:
    在这里插入图片描述
    所以:
    在这里插入图片描述
  3. 之后输入-u root -p
    在这里插入图片描述
    如果你下面出现:
    在这里插入图片描述
    打开你所要使用的mysql的my.ini:
    在这里插入图片描述

查看源码:

[mysql]
default-character-set=utf8

[mysqld]

port=3306
basedir=D:/phpstudy_pro/Extensions/MySQL5.7.26/
datadir=D:/phpstudy_pro/Extensions/MySQL5.7.26/data/
character-set-server=utf8
default-storage-engine=MyIsam
max_connections=100
collation-server=utf8_unicode_ci
init_connect='SET NAMES utf8'
innodb_buffer_pool_size=64M
innodb_flush_log_at_trx_commit=1
innodb_lock_wait_timeout=120
innodb_log_buffer_size=4M
innodb_log_file_size=256M
interactive_timeout=120
join_buffer_size=2M
key_buffer_size=32M
log_error_verbosity=1
max_allowed_packet=16M
max_heap_table_size=64M
myisam_max_sort_file_size=64G
myisam_sort_buffer_size=32M
read_buffer_size=512kb
read_rnd_buffer_size=4M
server_id=1
skip-external-locking=on
sort_buffer_size=256kb
table_open_cache=256
thread_cache_size=16
tmp_table_size=64M
wait_timeout=120


[client]
port=3306
default-character-set=utf8
secure_file_priv


将最后一句话 secure_file_priv="" 删除

[mysqld]
secure_file_priv=""
将其替换。
6. 输入密码:
在这里插入图片描述
注意这里的密码是小皮面板中root的密码。

成功进入mysql的界面是:
在这里插入图片描述

  1. 退出数据库:MySQL>exit
    提示:bye
    刷新数据库:MySQL>flush privileges;
    提示: Query OK,0 rows affected
Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐