Install MySQL
[email protected] ~]# yum install MySQL mysql-server mysql-devel
2. Start MySQL and set the boot from start
[[Email protected] ~]# service mysqld start/stop/restart/status #启动/shutdown/restart/status Chkconfig mysqld on/off[[email protecte D] ~]# chkconfig--list | grep mysqldmysqld 0:off1:off2:on3:on4:on5:on6:off
3. Related configurations
/etc/my.cnfmysql configuration file/var/lib/mysqlmysql database file port:3306mysql default port
5. Precautions
Mysql> quit #quit, exit, equivalent to ctrl+cbye[[email protected] ~]#; #MySQL a large log statement ends with a semicolon, note that it is a semicolon in English mode. Characters and strings are caused by ' ';
4.mysql Initialization and Login
[[email protected] ~]# mysql-u root-p ' 123456 ' [[email protected] ~]# mysql-u root-p-h localhost "-H" Specify service Address of the device
5. Create, view , and delete the current database
mysql> CREATE DATABASE Ultraera; Query OK, 1 row Affected (0.00 sec) mysql> SHOW databases;+--------------------+| Database |+--------------------+| Information_schema | | MySQL | | Test | | Ultraera |+--------------------+4 rows in Set (0.00 sec) mysql> DROP DATABASE Ultraera; Query OK, 0 rows Affected (0.00 sec)
6. Create, view, and delete the current table
#创建表格之前要先选择数据库mysql > use ultraera;Database changedmysql> CREATE TABLE Ultraera ( #create Create a table with at least 1 columns -> id int NOT NULL, #NOT NULL not empty,int integral type -> name char ( NOT NULL, ) #char () character , () defines the character length within -> age int not null ,     -> ); query ok, 0 rows affected (0.01 sec) mysql> desc ultraera;+-------+- ---------+------+-----+---------+----------------+| field | type | Null | Key | Default | Extra |+-------+----------+------+-----+---------+----------------+| id | int (one) | NO | | NULL | | | name | char ( | no | | null) | | | age | int (one) | no | | null | |+-------+----------+------+-----+---------+----------------+3 rows in set ( 0.00 SEC) mysql> drop table ultraera ; query ok, 0 rows affected (0.00 SEC)
This article is from the "South African Tribe" blog, please be sure to keep this source http://ultraera.blog.51cto.com/6640392/1583524
MySQL Database basics