Administrating A MySQL Server
Administrating A MySQL Server
1. From Unix:
shell> mysql -u username -h hostname -p password
mysql> SET PASSWORD FOR username@localhost=PASSWORD('new_password');
In our case we were able to change password specifying host name along
with user name:
shell> bin/myslqadmin u username h localhost
There are two options: use GRANT/REVOKE command or manipulating the MySQL
grant tables directly.
The preferred method is to use GRANT statements - more concise and less
error-prone.
If you modify the grant tables manually (using INSERT, UPDATE, etc.), you
should execute
a FLUSH PRIVILEGES statement to tell the server to reload the grant
tables.
myUser : A full superuser who can connect to the server from anywhere,
but who must use a password 'pass' to do so.
GRANT statements should be for both myUser@localhost and
myUser@"%".
to prevent the anonymous user entry for localhost take precedence.
admin: A user who can connect from localhost without a password and who
is granted
the RELOAD and PROCESS administrative privileges.
No database-related privileges are granted.
Add a user that has full rights to his database only but cannot see other
database:
mysql> GRANT USAGE ON *.* TO 'user'@'host' GRANT Select, Insert,
Update, Delete,
Create, Drop ON `database`.* TO 'user'@'host' FLUSH
PRIVELEGS;
The FILE privelege and WITH GRANT OPTION may not be the best way to
include, it is
only in case of creating another superuser with full set of privileges or
giving privileges to load data using mysql command INLOAD DATA.
'host','user','password','select','insert','update','delete','index','alte
r'
,'create','drop','grant','reload','shutdown','process','file'
'host','db','user','select','insert','update','delete','index','alter',
'create','drop','grant'
TABLE HOST: This controls which HOSTS are allowed what global access
rights.
'host','db','select','insert','update','delete','index','alter',
'create','drop','grant'
Backups in MySQL
For a SQL level backup of a table use SELECT INTO OUTFILE or BACKUP TABLE.
Monitoring tools