Basic Primer
============ Management mysql==========1. View MySQL version mysqladmin--version2. Start MySQL/etc/init.d/mysqld Startmysqld_safe&3after you have just installed MySQL, first change the password mysqladmin-U root Password"New_password";4. Login Mysql[[email Protected]~]# Mysql-uroot-penter Password:5. View Gallery show DATABASES;6. Turn off MySQL/etc/init.d/mysqld Stop[[email protected]~]# Mysqladmin-uroot-p shutdownenter Password:========= Check MySQL information =============1. See if MySQL is startedPS-ef|grepmysqldlsof-I.:33062. View library MySQL>show DATABASES;3. Go to library MySQL>Use library name;4. View table MySQL>show TABLES;5Displays data table properties, property types, primary key information, whether NULL, default value, and other information. MySQL>SHOW COLUMNS from table name;6. Displays detailed index information for the data table, including primary key (primary key). MySQL>SHOW INDEX from table name;7output MySQL database management system performance and statistics, \g output by column. MySQL>SHOW TABLE STATUS from library name \g;=============== Table Operation =============1. Create a library MySQL>create DATABASE STUDENTS;2. CREATE TABLE MySQL> CREATE TABLE Students (ID intNot NULL auto_increment primary key, nameChar(8) notNULL, sexChar(4) notNULL, age tinyint unsigned not NULL, telChar( -) NULL Default"-" );3. Show table properties, ID primary key, self-increment. MySQL>SHOW COLUMNS from students;+-------+---------------------+------+-----+---------+----------------+| Field | Type | Null | Key | Default | Extra |+-------+---------------------+------+-----+---------+----------------+|ID|int( One) | NO | PRI | NULL | auto_increment | | name |Char(8) | NO | | NULL | || sex |Char(4) | NO | | NULL | || Age | tinyint3) unsigned | NO | | NULL | || Tel |Char( -) | YES | | - | |+-------+---------------------+------+-----+---------+----------------+4. Inserting data MySQL> INSERT into students (Name,sex,age,tel) VALUES ("Tom","Mans", -,"15523232632");5. View table Data MySQL>Select*from students;6. modifying table data MySQL> Update students set name="Tim"whereID=1;========== Authorized ==================1. authorizing remote 192.168.31.0/24 The network segment is logged in with the test user with all operation permissions for the students library. MySQL> Grant all on students.* to test@"192.168.31.%"Identified by'Test'; MySQL>flush Privileges;2. telnet: MySQL-H192.168.31.100-utest-ptest
MySQL Simple management