1. Added the login format after password as follows:
Mysql -u root -p
2, modify the login password
1) mysqladmin -u username -P old password Password new password
Example: MySQLADMIN -U Root Password 21century
Note: Because the root does not have a password, the -p old password can be omitted.
2) Modify the root user password of the USER table directly:
mysql> user mysql;
MySQL> Update User Set Pasword = Password ('21century') where user = 'root';
mysql> flush privileges;
Note: Flush Privileges means to force refresh memory authorization forms, otherwise or buffered passwords.
3, whether the test password is modified successfully
1) Log in without password
[root @ Test1 local] # mysql
Error 1045: Access Denied for User: 'root @ localhost' (Using Password: NO)
Display errors, the password has been modified.
2) Log in with the modified password
[root @ Test1 local] # mysql -u root -p
ENTER Password: (Enter the modified password 21century)
Welcome to the mysql monitor. Commands end with; or / g.
Your MySQL Connection ID IS 177 TO Server Version: 3.23.48
Type 'help;' or '/ h' for help. Type '/ c' to clear the buffer.
MySQL>
success!
This is to modify the password through the mysqladmin command, or change the password by modifying the library.
4, start and stop
Start: MySQL starts from version 3.23.15, and the default installation After the service is started with mysql users, the root user is not allowed to start.
If you need to start with the root user, you must add -user = root parameters
(./safe_mysqld --user = root &)
Stop: mysqladmin -u root -p shutdown
5, export the Meeting database:
MySQLDUMP -UROOT -P21CENTURY Meeting> DB_MEeting.sql
Guide DBNAME database
MySQLDUMP -UROOT -P21Century DBNAME The import database can also perform a large number of SQL statements in a way similar to ORACLE @ my_script.sql, which is useful when using mysqldump. Example: #. / Mysql -uroot -p
(Note: CREATE DATABASE, CREATE TABLE, and INSERT INTO statements can be written in the top files above) 6, change the name Rename Table ZTemp to Ztemp4; 7, modify field properties Alter Table Bbabase Change News_id ID VARCHAR (5) Not NULL; 8, add a field after Content in the table ALTER TABLE BBABASE ADD Leave_time DateTime Not Null After Content; 9, increasing users Grant SELECT, UPDATE, INSERT ON Database Name. * To Username @ Login Host Identified by "Password" Example: Grant SELECT, UPDATE, INSERT, DELETE ON *. * To Test @ dev identified by "abc"; 10. Just use the MySQL service using the mysql service. You can also add -skip-networking parameters when starting to make MySQL misselect any TCP / IP connection (./safe_mysqld --skip-networking ", increasing security. (Very recommended) 11. What should I do if I forget the root password? Plus parameters - Skip-grant-tables when starting the MySQL server to skip the authentication of the license table (./SAFE_MYSQLD --SKIP-GRANT-TABLES &) So we can log in directly to the MySQL server, then modify the password of the root user, restart MySQL can log in with a new password.