Learning Mysql


--host=sadri.learningmysql.com \



Download 4.24 Mb.
View original pdf
Page340/366
Date04.08.2023
Size4.24 Mb.
#61806
1   ...   336   337   338   339   340   341   342   343   ...   366
Learning MySQL
--host=sadri.learningmysql.com \
-port \
--user=allmusic \
--password=the_password \
--database=music
This can be tiresome to type all the time, so you could save these values in the options file as:
[mysql]
host=sadri.learningmysql.com port=57777
user=allmusic
372 | Chapter 11:
Using an Options File

password=the_password
database=music
If you’re concerned about security, you can omit specifying a password and simply write the option password
:
[mysql]
host=sadri.learningmysql.com port=57777
user=allmusic password database=music
This way, the monitor knows that you want to use a password, and it’ll prompt you for the password before trying to connect to the server.
Structure of the Options File
We saw in the last section how you can specify options for the MySQL monitor. An options file can have a section for each program that uses it. For example, you can have a
[mysql]
section for the mysql program and a
[mysqldump]
section for the mysqldump program. Similarly, you can have a
[mysqld]
section for the MySQL server daemons mysqld
, mysqld_safe
, and mysqld-nt
Where options are common to all client programs, they can be consolidated under a
[client]
section. Similarly, options common to all server programs can be listed under a
[server]
section.
Be careful not to make program options too generic. For example, the mysql program is a client and takes a database option. However, mysqladmin and mysqlshow are examples of client programs that don’t understand this option. If you include the database option in the
[client]
section, like this:
[client]
database=music these programs will just complain and quit, as below mysqladmin status
mysqladmin: unknown variable 'database=music'
You should include the database option in a separate group for the
[mysql]
program,
rather than including it in the
[client]
group.
Let’s look at a more interesting options file:
[server]
user=mysql port=57777
basedir=/usr/local/mysql-standard-5.0.22-linux-i686
socket=/home/mysql/server1.sock

Download 4.24 Mb.

Share with your friends:
1   ...   336   337   338   339   340   341   342   343   ...   366




The database is protected by copyright ©ininet.org 2024
send message

    Main page