1. Increase the login format after the password is 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 of the start of root There is no password, so the -p old password can be omitted. 2) Directly modify the root user password of the USER table: 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 form, otherwise or buffered passwords. 3, the test password is modified successfully 1) Do not have a password to log in [root @ Test1 local] # mysql error 1045: Access Denied for user: 'root @ localhost' (using password '(using password ") Display error, the instruction 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 4, start and stop starting by modifying the library: MySQL starts from the 3.23.15 version, the default installation service To start with mysql users, not allowing root users 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 meeting database: mysqldump -uroot -p21century Meeting > db_meeting.sql Guide DBNAME Database MySQLDUMP -UROOT -P21CENTURY DBNAME Example: #. / Mysql -uroot -p
First, operation skills 1. If you play a command, I found that I forgot to add the semicolon after I entered the bus. You didn't need to re-play a command, as long as you have a semicolon to enter the car. That is to say, you can divide a complete command into a few lines, and then use the semicolon to end the flag OK. 2, you can use the cursor upside button to call up the previous command. But I used a MySQL old version I have not supported. I am using mysql-3.23.27-beta-win. Second, display command 1, display the database list. SHOW DATABASES; two databases just started: mysql and test. The mysql library is very important that there is a MySQL system information, we change your password and add users, actually use this library to operate. 2, the data table in the display library: use mysql; // Open the library, learn FoxBase, will not be unfamiliar with Show Tables; 3, display the structure of the data table: Describe table name; 4, Jian Ling: CREATE DATABASE library name ; Name; 8, the record in the display: SELECT * FROM table name; three, one to build a library and build table and instance DROP DATABASE IF EXISTS SCHOOL; // If there is School, remove the Create Database School; // Set the library School Use school; // Open the library School Create Table Teacher // Settles TEACHER (ID INT (3) Auto_Increment Not Null Primary Key, Name Char (10) Not Null, Address Varchar (50) Default 'Shenzhen', Year Date ; // The end of the table // below is inserted insert INTO TEACHER VALUES ('', 'Glchengang', 'Shenzhen No.1 ",' 1976-10-10 '); Insert Into Teacher Values (' ',' Jack ' , 'Shenzhen No.123', '1975-12-23'); Note: In the Table Table (1) Set the ID to the number field of length 3: int (3) and let each record automatically add one: Auto_increment does not empty: NOT NULL and let him become the primary field key (2) Set Name to a character field (3) set Address to the character field of length 50, and the default is Shenzhen. What is the difference between VARCHAR and CHAR? Only the following article will be said. (4) Set the Year of Year to the date field. If you type the above command on the MySQL prompt, it is not convenient to debug. You can write the above command to a text file to assume School.SQL, then copy to C: / Under, and enter the directory / mysql / bin in the DOS state, then type the following command: mysql -uroot -P password