Responsibilities of the database administrator
Server Startup and shutdown
User Account Maintenance
Log file Maintenance
Backup and copy of database
Server optimization
Software update of database management system
Security of Data Directory
Security of the server
Disaster recovery
Preventative Maintenance
``````````````````````````````````````````````````
Database Startup and shutdown
1, the start of the database:
Method One: Use service command to start MySQL
# service Mysqld Start
Mysqld is the MySQL daemon that starts the MySQL service by running it.
Method Two: Use Mysqld script to start MySQL
#/etc/init.d/mysqld Start
Method Three: Use the Safe_mysqld utility to start the MySQL service, this method can use the relevant parameters
# safe_mysqld&
Use the & symbol to run the safe_mysqld in the background.
```````````````````````````````````````````````````````````
Verify that MySQL is started:
# Service MYSQLD Status
Returns the following information indicating that it has started
MYSQLD (PID 1663) is running ...
1663 is the process number that the mysqld runs, and may vary depending on the number of processes running on different systems
If you need to restart MySQL you can use one of the following commands:
# Service Mysqld Restart
#/etc/init.d/mysqld Restart
````````````````````````````````````````````````````````
2, the database shutdown:
You can use one of the following commands:
# Service Mysqld Stop
#/etc/init.d/mysqld Stop
#/mysqladmin Shutdown
MySQL Management
Modify Root admin password
Method One:
Mysql>set password for ' account ' @ ' host ' = Old_password (' password ');
Update mysql.user Set password = old_password (' password ') where host = ' host ' and user = ' account ';
Flush privileges;
Method Two:
mysqladmin password ' CRQ '
User password
For MySQL passwords, you can use the password () and encrypt () functions for encryption
Mysql>select PASSWORD ("Alex");
"23FC96E064BE0017"
Note: ENCRYPT () is not available on Windows
Method Three: Use the UPDATE statement and the password () function to set the root password to CRP.
mysql> Update user Set Password=password (' Crq ')
-> where user= ' root ';
Returns the following information indicating that the authorization table user modified successfully
Query OK, 2 row affected (0.09 sec)
Rows matched:2 Changed:2 warnings:0
Note: This method modifies the authorization table user directly, and the server only loads the permission settings in the authorization table at startup, so you must use the client program flush in the MySQL environment Privileges command or use the Administrative Tools mysqladmin flush-privileges subcommand to notify the server to reload the authorization table.
mysql> flush Privileges; The entry into force is available at this time.
```````````````````````````````````````````````````````````````````
Changing the database storage path
Under window, all MySQL databases are stored in the "%mysqlroor%\data" directory.
Stop MySQL Service
modifying%systemroor%\my.ini files
[Mysqld]
Datadir=d:/data
Move all of the file and folder contents in the original directory to the new directory D:/data directory.
Restart the MySQL service
Modify MySQL Character set
Find MySQL profile My.ini, generally in C:\window\my.ini.
Add "DEFAULT-CHARACTER-SET=GBK #" or Gb2312,utf8 to the My.ini file
Restart the MySQL service
To delete an anonymous user:
myslq> Delete from user where user= ';
Returns the following information indicating that the anonymous user was deleted successfully
Query OK, 2 row affected (0.03 sec)
To add a new user right:
Use the GRANT statement to grant user permissions.
Grammar:
GRANT priv_type[(column_list)][,priv_type[(column_list)]
on {*.* | * | db_name.* | db_name.tabl_name | db_name}
To user_name [identified by ' Password ']
[, user_name [identified by ' password '] ...]
[With GRANT OPTION]
Create a new user
Create user name, maximum allowed for 16 English characters
Develop databases and tables that allow this user to access
Develop actions that allow the user to do something with the database
Develop remote connections that allow this user from which host/IP
To allow the user to authorize or revoke the authorization of another user
For example, add a superuser crq that can connect to a MySQL server from a local host, but must use a password to connect Crqpass
Mysql> Grant all on *.* to Crq@localhost identfied by ' crqpass ' with GRANT option;
Returns the following information indicating a successful permission setting
Query OK, 0 rows affected (0.02 sec)
For example, use the same method to add a superuser crq that can be connected to a MySQL server from anywhere else, but you must use a password to connect Crqpass
Mysql> Grant all on *.* to crq@ '% ' identified by ' Crqpass ' with GRANT option;
Current 1/2 page
12 Next read the full text