3

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

1 Answer 1

1

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 !!!

6
  • Before anything, I was wondering why I'm getting that error if it was working just fine before I changed the port, and I only changed the port number. The basedir and datadir variables are in double quotes already.basedir="C:/MySQL/", datadir="C:/MySQL/Data". Even by specifying the port, I get the same error.
    – Alex
    Oct 31, 2013 at 16:58
  • Please post the entire my.ini into the question. Oct 31, 2013 at 17:36
  • Are there other my.ini files on the DB Server ??? Oct 31, 2013 at 17:47
  • No other my.ini file.
    – Alex
    Oct 31, 2013 at 18:01
  • Updated my answer !!! Oct 31, 2013 at 18:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.