mysql登陆报错mysql: unknown variable 'basedir=
发表于:2025-11-08 作者:千家信息网编辑
千家信息网最后更新 2025年11月08日,使用mysql登陆数据库报错[root@localhost ~]# mysql -uroot -pmysql: unknown variable 'basedir=/usr'报错原因:配置文件里面的格
千家信息网最后更新 2025年11月08日mysql登陆报错mysql: unknown variable 'basedir=使用mysql登陆数据库报错
[root@localhost ~]# mysql -uroot -p
mysql: unknown variable 'basedir=/usr'
报错原因:
配置文件里面的格式有误,[mysqld]写成了[mysql]
[root@localhost step]# cat /etc/my.cnf
[mysql]
basedir = /usr
datadir = /var/lib/mysql
log-error = /var/lib/mysql/localhost.localdomain.err
pid-file = /var/lib/mysql/localhost.localdomain.pid
log-bin=/var/lib/mysql/mysqld-bin
binlog_format=row
binlog-do-db=dmcdbTEST
解决方法:
将[mysql]改为[mysqld]
[root@localhost step]# cat /etc/my.cnf
[mysqld]
basedir = /usr
datadir = /var/lib/mysql
log-error = /var/lib/mysql/localhost.localdomain.err
pid-file = /var/lib/mysql/localhost.localdomain.pid
log-bin=/var/lib/mysql/mysqld-bin
binlog_format=row
binlog-do-db=dmcdbTEST
之后重启数据库
[root@localhost mysql]# mysqladmin -uroot -p shutdown
[root@localhost mysql]# mysqld_safe --defaults-file=/etc/my.cnf &
数据库可以正常连接
[root@localhost ~]# mysql -uroot -p
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.21-70.1 Percona Server (GPL), Release 70.1, Revision 698
Copyright (c) 2009-2014 Percona LLC and/or its affiliates
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show global variables like '%double%';
+--------------------+-------+
| Variable_name | Value |
+--------------------+-------+
| innodb_doublewrite | ON |
+--------------------+-------+
1 row in set (0.00 sec)
[root@localhost ~]# mysql -uroot -p
mysql: unknown variable 'basedir=/usr'
报错原因:
配置文件里面的格式有误,[mysqld]写成了[mysql]
[root@localhost step]# cat /etc/my.cnf
[mysql]
basedir = /usr
datadir = /var/lib/mysql
log-error = /var/lib/mysql/localhost.localdomain.err
pid-file = /var/lib/mysql/localhost.localdomain.pid
log-bin=/var/lib/mysql/mysqld-bin
binlog_format=row
binlog-do-db=dmcdbTEST
解决方法:
将[mysql]改为[mysqld]
[root@localhost step]# cat /etc/my.cnf
[mysqld]
basedir = /usr
datadir = /var/lib/mysql
log-error = /var/lib/mysql/localhost.localdomain.err
pid-file = /var/lib/mysql/localhost.localdomain.pid
log-bin=/var/lib/mysql/mysqld-bin
binlog_format=row
binlog-do-db=dmcdbTEST
之后重启数据库
[root@localhost mysql]# mysqladmin -uroot -p shutdown
[root@localhost mysql]# mysqld_safe --defaults-file=/etc/my.cnf &
数据库可以正常连接
[root@localhost ~]# mysql -uroot -p
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.21-70.1 Percona Server (GPL), Release 70.1, Revision 698
Copyright (c) 2009-2014 Percona LLC and/or its affiliates
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show global variables like '%double%';
+--------------------+-------+
| Variable_name | Value |
+--------------------+-------+
| innodb_doublewrite | ON |
+--------------------+-------+
1 row in set (0.00 sec)
数据
数据库
登陆
原因
文件
方法
格式
配置
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
网络技术大赛相关图片
互联网公司黑科技博览会
数据库等保安全员
往届生网络安全吗
湖北综合软件开发定做价格
微信app服务器一年得多少钱
安卓上位机软件开发教程
在线视频播放服务器端
高青mes软件开发公司
软件开发责任终身
潍坊商城软件开发外包公司
r星俄罗斯服务器
北京软件开发就业如何
wex5获取数据库连接失败
三峡学院数据库基础考试
软件开发专业如何进政府部门
唱响软件开发
网络安全屏保高清
网络安全是电子商务
中国电信国产服务器一年用多少量
软件开发需求模型
三级网络技术上机考题型
dell服务器远程管理账号
网络安全法执法检查报告
华为2285服务器噪音大吗
公安部网络安全保卫局刘
山西太原触控答题软件开发公司
软件专业数据库春季高考占多少分
必须要遵守的五条网络安全规则
按列存储的数据库