mysql快速入门



一、下载并解压
$ wget http://cdn.mysql.com/Downloads/MySQL-5.5/MySQL-5.5.42-1.el6.x86_64.rpm-bundle.tar
解压后得到以下几个文件:
$ tar -xvf MySQL-5.5.42-1.el6.x86_64.rpm-bundle.tar  
MySQL-shared-5.5.42-1.el6.x86_64.rpm
MySQL-shared-compat-5.5.42-1.el6.x86_64.rpm
MySQL-server-5.5.42-1.el6.x86_64.rpm
MySQL-devel-5.5.42-1.el6.x86_64.rpm
MySQL-test-5.5.42-1.el6.x86_64.rpm
MySQL-client-5.5.42-1.el6.x86_64.rpm
MySQL-embedded-5.5.42-1.el6.x86_64.rpm

二、安装
1、安装server
(1)# rpm -ivh MySQL-server-5.5.42-1.el6.x86_64.rpm

(2)若出现冲突错误,则是由于linux可能自带了mysql的库,需要先将之删除
# rpm -e mysql-libs.x86_64 --nodeps

2、安装client
# rpm -ivh MySQL-client-5.5.42-1.el6.x86_64.rpm

三、关于配置文件
# ls *.cnf
my-huge.cnf  my-innodb-heavy-4G.cnf  my-large.cnf  my-medium.cnf  my-small.cnf
# pwd
/usr/share/mysql
使用rpm方法进行安装时,配置文件放在/usr/share/mysql中,可根据需要放到其它地方。

四、启动及关闭
1、方式一:命令行方式
# mysqld_safe &
# mysqladmin -uroot shutdown

2、方式二:服务方式
# service mysql start
# service mysql stop
# service mysql restart

3、连接数据库开始使用
# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.42 MySQL Community Server (GPL)

Copyright (c) 2000, 2015, 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>

posted @ 2015-04-28 14:31  eagleGeek  阅读(130)  评论(0编辑  收藏  举报