Administrating A MySQL Server
Administrating A MySQL Server
You can recover MySQL database server password with following five easy steps.
Step # 2: Start the MySQL (mysqld) server/daemon process with the --skip-grant-tables option
so that it will not prompt for password.
Step # 4: Setup new mysql root account password i.e. reset mysql password.
Here are commands you need to type for each step (login as the root user):
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
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
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','al
ter'
,'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