A .my.cnf file (the period at the beginning of the filename is mandatory) is a file that contains some preset MySQL preferences for you.
If the file does not exist in your home directory (top level directory) of your account, then you can create one using a plain text editor like pico or vi. If you create or edit this file on your own computer and then upload it to the server, you'll need to use a plain text editor like Notepad or Homesite, not MS Word.
Because this file name begins with a period, some FTP programs may give you trouble seeing it in directory listings. At a shell prompt, you can always see it, if it is there, by typing
ls -la /A basic .my.cnf file has the following lines. A pound sign '#' before any line means that line should be ignored by the MySQL interpreter.
[client]Where DBUSERNAME, DBPASSWORD, DBSERVER and
user = DBUSERNAME
password = DBPASSWORD
host = DBSERVER
[mysql]
database = DBNAME
DBNAME should be replaced with your own correct database username, database hostname, database name and database password. You will not have any of these until you create a database through your Control Panel.
With a correctly setup .my.cnf file, you will be able to get a MySQL Monitor prompt by just typing
mysqlat your shell prompt without any of the arguments such as -h, -u, -p, and without having to explicitly type out your database name. The preferences also work with mysqldump and other mysql related shell commands.
0 comments:
Post a Comment