How to configure two different port for MySQL on same machine? I know that default port is 3306. But I also want to configure 3307 and 3308. Is it possible?
One bonus question with current one ;)
Can we assign Different Ports to Different Databases and also can assign/create Credentials respectively?
Unfortuantely the MySQL port can serve only ONE client.
You need to edit your mysql config file, my. cnf in /etc/my. cnf and change the port to 3306. Then restart mysql.
You can use the --port=port_num
option. Have a look here for more information on how to configure multiple mysql instances.
You can copy /etc/mysql/my.cnf
, change the port in it and change the pathes to data dirs as well, because i'm pretty sure You can't have more than 1 instance of mysql serving from the same directories.
Check http://dev.mysql.com/doc/refman/5.1/en/multiple-servers.html.
ex :
cp /etc/mysql/my.cnf /etc/mysql/my-3307.cnf
//edit my-3307.cnf, for example
port = 3307
basedir = /var/lib/mysql-3307
datadir = /var/lib/mysql-3307
//end-edit
mysql_upgrade --defaults-file=/etc/mysql/my-3307.cnf #checks the syntax and creates the dirs you need.
#start mysqld
mysqld --defaults-file=/etc/mysql/my-3307.cnf
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With