User accounts are passworded. When connecting to the database the password is encrypted to assure that it can not be intercepted and used by others.
The mysql database contains three tables. They are defined below.
Field | Type | Null | Key | Default | Extra |
---|---|---|---|---|---|
Host | char(60) | PRI | |||
Db | char(32) | PRI | |||
User | char(16) | PRI | |||
Select_priv | char(1) | N | |||
Insert_priv | char(1) | N | |||
Update_priv | char(1) | N | |||
Delete_priv | char(1) | N | |||
Create_priv | char(1) | N | |||
Drop_priv | char(1) | N | |||
File_priv | char(1) | N |
Field | Type | Null | Key | Default | Extra |
---|---|---|---|---|---|
Host | char(60) | PRI | |||
Db | char(32) | PRI | |||
Select_priv | char(1) | N | |||
Insert_priv | char(1) | N | |||
Update_priv | char(1) | N | |||
Delete_priv | char(1) | N | |||
Create_priv | char(1) | N | |||
Drop_priv | char(1) | N |
Field | Type | Null | Key | Default | Extra |
---|---|---|---|---|---|
Host | char(60) | PRI | |||
User | char(16) | PRI | |||
Password | char(8) | ||||
Select_priv | char(1) | N | |||
Insert_priv | char(1) | N | |||
Update_priv | char(1) | N | |||
Delete_priv | char(1) | N | |||
Create_priv | char(1) | N | |||
Drop_priv | char(1) | N | |||
Reload_priv | char(1) | N | |||
Shutdown_priv | char(1) | N | |||
Process_priv | char(1) | N | |||
File_priv | char(1) | N |
$ mysql mysql mysql> INSERT INTO user VALUES ('%','monty',password('something'), -> 'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y'); mysql> INSERT INTO user (host,user,password) values('localhost','dummy','') ; mysql> INSERT INTO user VALUES ('%','admin','','N','N','N','N','N','N','Y','N','Y','N') ; mysql> quit $ mysqladmin reload |
monty: | Full superuser, but must use password when using mysql.
|
dummy: | Must be granted individual database privileges through table
'db'.
|
admin: | Doesn't need a password but is only allowed to use
'mysqladmin reload' and 'mysqladmin
processlist'. May be granted individual database privileges
through the 'db' table.
|
NOTE: You MUST use the password()
function when
creating a user that has a password.
The mysql database system expects passwords to be
stored encrypted.
Attribute assigned in the user table over-ride attribute assigned to a user in a given DB. If you are paranoid or have a server that provides multiple databases you probably want to create users in the user account with no privileges, and then assign appropriate privileges on a database by database basis.
(Need to document these -mke)
Tuning mysqld
$ mysqld -O Possible variables to option -O are: keybuffer current value: 1048568 max_allowed_packet current value: 65536 net_buffer_length current value: 16384 max_connections current value: 128 table_cache current value: 64 recordbuffer current value: 524280 sortbuffer current value: 2097144The following table explains a bit about each of the above listed values and gives some hints on how you might want to tweak them for better performance.
keybuffer |
Buffer to hold all recently used keys. A big buffer gives the best
performance. With the -Sl switch only one buffer is allocated.
|
max_allowed_packet |
The server connection buffer may be resized up to this if the client
gives long commands. The initial buffer is 'net_buffer_length'. One
buffer is allocated per connection.
|
net_buffer_length |
Initial size of the connection buffer. One buffer is allocated per
connection.
|
max_connections |
The maximum number of connections that mysqld can have open at the same
time.
|
table_cache |
Maximum number of tables kept open on the server. Tables are kept open to
give better query speed on frequently used tables.
|
recordbuffer | Buffer used to read records sequentially. One buffer will be allocated per
connection.
|
sortbuffer | Buffer used when sorting. One buffer will be allocated per connection.
|