-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCLIENT PROGRAM - specifying MySQL command options.sql
More file actions
62 lines (44 loc) · 1.67 KB
/
CLIENT PROGRAM - specifying MySQL command options.sql
File metadata and controls
62 lines (44 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*
!!BASIC - CLIENT PROGRAM - SPECIFYING MySQL COMMAND OPTIONS!!
> When you invoke the mysql program without command options, it
exits immediately with an “access denied” message
> You must specify connection parameters. Do this on the command line,
in an option file, or using a mix of the two
EXAMPLE:
> If you invoke mysql with no command options, the result may be an “access denied”
error. To avoid that, connect to the MySQL server as shown
*/
% mysql -h localhost -u cbuser -p
Enter password: cbpass
/*
> Each option is the single-dash “short” form: -h and -u to specify the hostname and
username, and -p to be prompted for the password.
> There are also corresponding double-dash “long” forms: --host, --user, and --password
*/
% mysql --host=localhost --user=cbuser --password
Enter password: cbpass
/*
To see all options that mysql supports, use this command
*/
% mysql --help
/*
> npr. to generate a dump file named cookbook.sql that contains a backup of the
tables in the cookbook database, execute mysqldump like this
*/
% mysqldump -h localhost -u cbuser -p cookbook > cookbook.sql
Enter password: cbpass
/*
> npr. to stop the server, invoke mysqladmin as follows
*/
% mysqladmin -h localhost -u root -p shutdown
Enter password: ← enter MySQL root account password here
/*
> To find out which options the mysql program will read from option files,
use this command
*/
% mysql --print-defaults
/*
> npr. mysqldump looks in both the [client] and [mysqldump] groups for options.
To check which option-file settings are in those groups, use this command
*/
% my_print_defaults client mysqldump