Get the App
SLTechnology News&Howtos  ›  Database  › 

Mysql login error mysql: unknown variable & # 039 investors basedir =

Shulou Source: shulou.com Published: 2022-06-01 06:11:19 09月22日 Update

Using mysql to log in to the database to report an error

[root@localhost] # mysql-uroot-p

Mysql: unknown variable 'basedir=/usr'

Reason for reporting an error:

The format in the configuration file is incorrect. [mysqld] is written as [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

Solution:

Change [mysql] to [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

Then restart the database

[root@localhost mysql] # mysqladmin-uroot-p shutdown

[root@localhost mysql] # mysqld_safe-- defaults-file=/etc/my.cnf &

The database can connect normally.

[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)

Tags: Data database login reason file method format configuration Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft Linux Xiaomi MySQL vpn