MySQL Simple management

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.