1.yum
yum -y install mysql-server mysql
2.RPM安装
http://dev.mysql.com/downloads/ 下载RPM包,请确认服务器版本,我的是红帽5.9,下载的是下面的版本,bundle是集合包
MySQL-5.6.21-1.rhel5.x86_64.rpm-bundle.tar
[[email protected] ~]# cd /soft/ [[email protected] soft]# ll 总计 608028 -rwxr--r-- 1 root root 310988800 10-18 13:28 MySQL-5.6.21-1.rhel5.x86_64.rpm-bundle.tar -rw-r--r-- 1 7155 wheel 23156366 09-12 16:25 MySQL-client-5.6.21-1.rhel5.x86_64.rpm -rw-r--r-- 1 7155 wheel 4579502 09-12 16:25 MySQL-devel-5.6.21-1.rhel5.x86_64.rpm -rw-r--r-- 1 7155 wheel 117279604 09-12 16:26 MySQL-embedded-5.6.21-1.rhel5.x86_64.rpm -rw-r--r-- 1 7155 wheel 88524802 09-12 16:27 MySQL-server-5.6.21-1.rhel5.x86_64.rpm -rw-r--r-- 1 7155 wheel 2404168 09-12 16:27 MySQL-shared-5.6.21-1.rhel5.x86_64.rpm -rw-r--r-- 1 7155 wheel 75030266 09-12 16:28 MySQL-test-5.6.21-1.rhel5.x86_64.rpm
rpm -Uvh MySQL-*.rpm
mysql> SET PASSWORD FOR ‘root‘@‘localhost‘=PASSWORD(‘root‘); Query OK, 0 rows affected (0.07 sec)
3.mysql的命令
show databses;
use mysql;
show tables;
describe user;
create database cms;
select database();
DATETIME(占8字节)
TIMESTAMP(占4字节)
DATE(占4字节)
YEAR(占1字节)
TIME(占3字节)
时间: 2024-10-25 20:20:14