# How to install and configure MySQL server properly?



## olo (Oct 27, 2013)

Hi,

I have installed mysql56-server form ports and now I can't find my-medium.cnf. I've read here - http://dev.mysql.com/doc/refman/5.6/en/server-default-configuration-file.html - that there is /usr/local/share/mysql/my-default.cnf instead and that `mysql_install_db` should create some basic my.cfg file for me. It is just coping the example file and the example file - my-default.conf contains only variables names without values. How can I display the default build in settings?

What are the defaults for these variables?


```
# basedir = .....
# datadir = .....
# port = .....
# server_id = .....
# socket = .....
```

The `mysql_install_db` command is creating a my.cnf file in the folder in which it was run - e.g. /usr/local/. Should I run it in /usr/local/etc/ or where?

Should I run something more after creating the my.cfg config file to configure my MySQL server properly?


```
mysql_install_db
echo 'mysql_enable="YES"' >> /etc/rc.conf
service mysql-server start
mysql_secure_installation
```


----------



## SirDice (Oct 28, 2013)

olo said:
			
		

> How can I display the default build in settings?


`mysqladmin extended-status` or from within MySQL:

```
SHOW GLOBAL STATUS;
```

I would suggest not creating a my.cnf unless you have to.


----------



## Beeblebrox (Oct 28, 2013)

> Should I run something more after creating the my.cfg config file to configure my MySQL server properly?



The questions under that heading relate to whether you want to start mysql automatically at boot-time or whether you want to start it manually; if and when you should need it. Your preference. to manually start, run `# service mysql-server onestart`. mysql_install_db should execute upon the server starting for the first time - not necessary AFAIK.

If you decide to create a my.conf, edit and place in /etc/rc.conf the location you have chosen to place that file, so that it gets correctly read:

```
mysql_defaults_file="/usr/local/etc/my.conf"
```


----------

