[root@rhel6 scripts]# cp /opt/mysql/mysql5.6.18/support-files/mysql.server /etc/init.d/mysqld
[root@rhel6 scripts]# cp /opt/mysql/mysql5.6.18/support-files/my-default.cnf /etc/my.cnf
cp: overwrite `/etc/my.cnf'? yes
注意不要使用系统自带的/etc/my.cnf文件,否则启动mysql服务时会报错。
Starting MySql.. ERROR! The server quit without updating PID file(/var/mysql/data/rhel6.pid).
5、修改参数
[root@rhel6 scripts]# vi /etc/init.d/mysqld
##修改下面两个参数如下
basedir=/opt/mysql/mysql5.6.18
datadir=/mysqldata
6、加入开机启动
[root@rhel6 scripts]# chkconfig --levels 235 mysqld on
[root@rhel6 scripts]# chkconfig --list mysqld
mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off
7、启动mysql服务
[root@rhel6 scripts]# service mysqld start
Starting MySQL. SUCCESS!
8、连接mysql
[root@rhel6 scripts]# mysql -uroot
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.18-enterprise-commercial-advanced MySQL Enterprise Server - Advanced Edition (Commercial)
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.00 sec)
9、mysql的帮助
1.用“?contents”命令来显示所有可供查询的的分类
mysql> ? contents
You asked for help about help category: "Contents"
For more information, type 'help <item>', where <item> is one of the following
categories:
Account Management
Administration
Compound Statements
Data Definition
Data Manipulation
Data Types
Functions
Functions and Modifiers for Use with GROUP BY
Geographic Features
Help Metadata
Language Structure
Plugins
Procedures
Storage Engines
Table Maintenance
Transactions
User-Defined Functions
Utility
mysql> help data types
You asked for help about help category: "Data Types"
For more information, type 'help <item>', where <item> is one of the following
topics:
AUTO_INCREMENT
BIGINT
BINARY
BIT
BLOB
BLOB DATA TYPE
BOOLEAN
CHAR
CHAR BYTE
DATE
DATETIME
DEC
DECIMAL
DOUBLE
DOUBLE PRECISION
ENUM
FLOAT
INT
INTEGER
LONGBLOB
LONGTEXT
MEDIUMBLOB
MEDIUMINT
MEDIUMTEXT
SET DATA TYPE
SMALLINT
TEXT
TIME
TIMESTAMP
TINYBLOB
TINYINT
TINYTEXT
VARBINARY
VARCHAR
YEAR DATA TYPE
mysql> help int
Name: 'INT'
Description:
INT[(M)] [UNSIGNED] [ZEROFILL]
A normal-size integer. The signed range is -2147483648 to 2147483647.
The unsigned range is 0 to 4294967295.
URL: