Run the mysql SQL file mysql-uroot-proot in linux to enter mysql and then run source/var/ftp/pub/sogoodsoft. SQL. Go to www.2cto.com for the following content: Summary of mysql commands in linux-essential for learning linux + mysql I. Summary of some MySQL commands in Linux: 1. command for starting mysql in Linux: mysqladmin start/ect/init. d/mysql start (the installation path of mysql is earlier) 2. command for restarting mysql in Linux: mysqladmin restart/ect/init. d/mysql restart (the preceding mysql installation path) 3. command to disable mysql in Linux: mysqladmin shutdown/ect/init. d/mysql shutdown (the installation path of mysql is earlier)
4. Connect to mysql on the local machine: Enter the mysql \ bin directory, type the mysql-uroot-p command, and press enter to prompt you to enter the password. Exit mysql command: exit (Press ENTER) 5. change mysql password: mysqladmin-u username-p old PASSWORD new password or enter mysql command line set password for root = PASSWORD ("root ");
6. Add new users. (Note: commands in the mysql environment are followed by a semicolon as the command Terminator) grant select on database. * to username @ login host identified by "password". If a user test password is added to 123, the user can log on to any host, all databases are permitted to query, insert, modify, and delete databases. First, use the root user to connect to mysql, and then type the following command: grant select, insert, update, delete on *. * to "Identified by" 123 "; 2. For mysql database operations, you must first log on to mysql. The operations are performed at the mysql prompt, in addition, each command ends with a semicolon (;). 1. The database list is displayed. Show databases; 2. display the data table in the database: use mysql; // open the database show tables; 3. display the data table structure: describe table name; 4. create database name; 5. create a table: use database Name; create table Name (field setting list); 6. delete database and table: drop database name; drop table name; 7. Clear the records in the Table: delete from table name; 8. display the records in the Table: select * from table name; 9. Modify the encoding if you want to change the encoding format of mysql: when mysql is started, add the -- default-character-set = gbk command line to the mysqld_safe command line. If you want to change the encoding format of a database, enter the alter database db_name default character se command at the mysql prompt. T gbk; www.2cto.com 3. Data Import and Export 1. Text data to the database should conform to the format: field data is separated by the tab key, and null value is used instead. Example: 1 name duty 2006-11-23 data import command load data local infile "file name" into table name; 2. Export Database and table mysqldump -- opt news> news. SQL (back up all the tables in the database news to news. SQL file, news. SQL is a text file with any file name .) Mysqldump -- opt news author article> author. article. SQL (back up the author table and article table in the database news to author. article. SQL file, author. article. SQL is a text file with any file name .)
Mysqldump -- databases db1 db2> news. SQL (back up database dbl and db2 to the news. SQL file. news. SQL is a text file with any file name .) Mysqldump-h host-u user-p pass -- databases dbname> file. dump is to import the database dbname named "user" and "password pass" on the host to the file. mysqldump -- all-databases> all-databases. SQL in dump (back up all the databases to all-databases. SQL files, the all-databases. SQL is a text file, any file name .) 3. Import Data mysql <all-databases. SQL (import database) mysql> source news. SQL; (run the mysql command to import the table) www.2cto.com I. Connection to MySQL format: mysql-h host address-u username-p User Password 1. Example 1: connect to MYSQL on the local machine. First, open the DOS window, enter the directory mysqlbin, then type the command mysql-uroot-p, and press enter to prompt you to enter the password. If you have just installed MYSQL, super User root has no password, so press enter to enter MYSQL. The MYSQL prompt is: mysql>.
2. Example 2: connect to MYSQL on the remote host. Assume that the IP address of the remote host is 110.110.110.110, the user name is root, and the password is abcd123. Enter the following command: mysql-h110.110.110.110-uroot-pabcd123 (Note: you do not need to add spaces to the u and root, the same applies to others). 3. exit MYSQL: exit (Press ENTER ).