Thesql 5.1 — unknown variable ‘basedir=c:/thesql/’

MySQLmysql-5mysql-5.1windows

I recently changed the default port(3306) to another for mysql.
I did it by changing the my.ini file and did restart of the server.
No other changes were made whatsoever.
When connecting using a GUI no problem.
When I try using command prompt (mysql -u root -p) I get the following error.

mysql: unknown variable 'basedir=c:/mysql/'

Running on
Windows Server 2008 R2
MySQLServer 5.1

my.ini FILE info (removed some commented lines)

[client]
port= new_port

##The MySQL server
Path to installation directory. All paths are usually resolved relative to this.
basedir="C:/MySQL/"
#Path to the database root
datadir="C:/MySQL/"
#Set the default character set.
default-character-set=latin1

[mysqld]
#password=your_password
port = new_port
#socket = /tmp/mysql.sock
key_buffer_size = 384M
max_allowed_packet = 1M
table_open_cache = 512
sort_buffer_size=4M
read_buffer_size = 2M
read_rnd_buffer_size = 8M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size=201M
# Try number of CPU's*2 for thread_concurrency
thread_concurrency = 8

#Path to installation directory. All paths are usually resolved relative to this.
basedir = "C:/MySQL/"

#Path to the database root
datadir = "C:/MySQL/Data/"

#The default storage engine that will be used when create new tables when
default-storage-engine=MyISAM

# The maximum amount of concurrent sessions the MySQL server will
# allow. One of these connections will be reserved for a user with
# SUPER privileges to allow the administrator to login even if the
# connection limit has been reached.
max_connections=160

# The number of open tables for all threads. Increasing this value
# increases the number of file descriptors that mysqld requires.
# Therefore you have to make sure to set the amount of open files
# allowed to at least 4096 in the variable "open-files-limit" in
# section [mysqld_safe]
table_cache=320

# Maximum size for internal (in-memory) temporary tables. If a table
# grows larger than this value, it is automatically converted to disk
# based table This limitation is for a single table. There can be many
# of them.
tmp_table_size=205M

#Enable this option only if you would like to use InnoDB tables.
skip-innodb
#Don't allow new user creation by the user who has no write privileges to the mysql.user table.
safe-user-create
#Start without grant tables. This gives all users FULL ACCESS to all tables!
skip-grant-tables
#Set the default character set.
default-character-set=LATIN1

# required unique id between 1 and 2^32 – 1
# defaults to 1 if master-host is not set
# but will not function as a master if omitted
server-id = 1

#If no specific storage engine/table type is defined in an SQL-Create statement the default type will be used.
default-storage-engine=myisam
#Enable this option only if you would like to use InnoDB tables.
skip-innodb
#The number of simultaneous clients allowed.
max_connections=160
#The number of open tables for all threads.
table_cache=320
#If an in-memory temporary table exceeds this size, MySQL will automatically convert it to an on-disk MyISAM table.
tmp_table_size=205M

#Don't allow new user creation by the user who has no write privileges to the mysql.user table.
safe-user-create
#Start without grant tables. This gives all users FULL ACCESS to all tables!
skip-grant-tables

#Set the default character set.
default-character-set=LATIN1

Best Answer

Thank for posting the my.ini

PROBLEM: You have the basedir and datadir under the [client] section

basedir and datadir are server-only options, not client program options.

SOLUTION : Remove them from under the [client] section and you are good to go !!!

When done, this

[client]
port= new_port

##The MySQL server
Path to installation directory. All paths are usually resolved relative to this.
basedir="C:/MySQL/"
#Path to the database root
datadir="C:/MySQL/"
#Set the default character set.
default-character-set=latin1

should now be this:

[client]
port= new_port

Give it a Try !!!