在小皮面板中使用cmd进入mysql命令,包含mysql错误unknown variable 'secure_file_priv’解决方法(超详细)
- 先按win+r键打开运行对话框,输入cmd,进入:
- 在第一行输入: d:
- 紧接着在后面输入:你所使用mysql的位置(精确到bin的位置)
例如:我的是:
所以:
- 之后输入-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的界面是:
- 退出数据库:MySQL>exit
提示:bye
刷新数据库:MySQL>flush privileges;
提示: Query OK,0 rows affected