2014-07-13 16:37:49
来 源
中存储网
MySQL
1. 下载MySQL-client-5.6.11-1.rhel5.x86_64.rpmMySQL-server-5.6.11-1.rhel5.x86_64.rpmMySQL-devel-5.6.11-1.rhel5.x86_64.rpm2. 安装su root
1. 下载
     MySQL-client-5.6.11-1.rhel5.x86_64.rpm
     MySQL-server-5.6.11-1.rhel5.x86_64.rpm
     MySQL-devel-5.6.11-1.rhel5.x86_64.rpm

2. 安装
su root,更换用户
 
安装server
rpm -ivh MySQL-server-5.6.11-1.rhel5.x86_64.rpm

Preparing...                ########################################### [100%]
   1:MySQL-server           ########################################### [100%]
2013-04-19 09:33:06 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2013-04-19 09:33:06 6905 [Note] InnoDB: The InnoDB memory heap is disabled
2013-04-19 09:33:06 6905 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2013-04-19 09:33:06 6905 [Note] InnoDB: Compressed tables use zlib 1.2.3
2013-04-19 09:33:06 6905 [Note] InnoDB: Using Linux native AIO
2013-04-19 09:33:06 6905 [Note] InnoDB: Using CPU crc32 instructions
2013-04-19 09:33:06 6905 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2013-04-19 09:33:06 6905 [Note] InnoDB: Completed initialization of buffer pool
2013-04-19 09:33:06 6905 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2013-04-19 09:33:06 6905 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2013-04-19 09:33:06 6905 [Note] InnoDB: Database physically writes the file full: wait...
2013-04-19 09:33:06 6905 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
2013-04-19 09:33:06 6905 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
2013-04-19 09:33:07 6905 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2013-04-19 09:33:07 6905 [Warning] InnoDB: New log files created, LSN=45781
2013-04-19 09:33:07 6905 [Note] InnoDB: Doublewrite buffer not found: creating new
2013-04-19 09:33:07 6905 [Note] InnoDB: Doublewrite buffer created
2013-04-19 09:33:07 6905 [Note] InnoDB: 128 rollback segment(s) are active.
2013-04-19 09:33:07 6905 [Warning] InnoDB: Creating foreign key constraint system tables.
2013-04-19 09:33:07 6905 [Note] InnoDB: Foreign key constraint system tables created
2013-04-19 09:33:07 6905 [Note] InnoDB: Creating tablespace and datafile system tables.
2013-04-19 09:33:07 6905 [Note] InnoDB: Tablespace and datafile system tables created.
2013-04-19 09:33:07 6905 [Note] InnoDB: Waiting for purge to start
2013-04-19 09:33:07 6905 [Note] InnoDB: 5.6.11 started; log sequence number 0
A random root password has been set. You will find it in '/root/.mysql_secret'.
2013-04-19 09:33:07 6905 [Note] Binlog end
2013-04-19 09:33:07 6905 [Note] InnoDB: FTS optimize thread exiting.
2013-04-19 09:33:07 6905 [Note] InnoDB: Starting shutdown...
2013-04-19 09:33:09 6905 [Note] InnoDB: Shutdown completed; log sequence number 1625977
2013-04-19 09:33:09 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2013-04-19 09:33:09 6928 [Note] InnoDB: The InnoDB memory heap is disabled
2013-04-19 09:33:09 6928 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2013-04-19 09:33:09 6928 [Note] InnoDB: Compressed tables use zlib 1.2.3
2013-04-19 09:33:09 6928 [Note] InnoDB: Using Linux native AIO
2013-04-19 09:33:09 6928 [Note] InnoDB: Using CPU crc32 instructions
2013-04-19 09:33:09 6928 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2013-04-19 09:33:09 6928 [Note] InnoDB: Completed initialization of buffer pool
2013-04-19 09:33:09 6928 [Note] InnoDB: Highest supported file format is Barracuda.
2013-04-19 09:33:09 6928 [Note] InnoDB: 128 rollback segment(s) are active.
2013-04-19 09:33:09 6928 [Note] InnoDB: Waiting for purge to start
2013-04-19 09:33:09 6928 [Note] InnoDB: 5.6.11 started; log sequence number 1625977
2013-04-19 09:33:09 6928 [Note] Binlog end
2013-04-19 09:33:09 6928 [Note] InnoDB: FTS optimize thread exiting.
2013-04-19 09:33:09 6928 [Note] InnoDB: Starting shutdown...
2013-04-19 09:33:11 6928 [Note] InnoDB: Shutdown completed; log sequence number 1625987  
A RANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER !
You will find that password in '/root/.mysql_secret'. You must change that password on your first connect,
no other statement but 'SET PASSWORD' will be accepted.
See the manual for the semantics of the 'password expired' flag.
Also, the account for the anonymous user has been removed.
In addition, you can run:
  /usr/bin/mysql_secure_installation
which will also give you the option of removing the test database.
This is strongly recommended for production servers.
See the manual for more instructions.
Please report any problems with the /usr/bin/mysqlbug script!
The latest information about MySQL is available on the web at
 http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
 
New default config file was created as /usr/my.cnf and
will be used by default by the server when you start it.
You may edit this file to change server settings
需要注意的几个文件:'/root/.mysql_secret'存有初始密码;/usr/my.cnf为配置文件
 
安装client
rpm -ivh MySQL-client-5.6.11-1.rhel5.x86_64.rpm
Preparing...                ########################################### [100%]
   1:MySQL-client           ########################################### [100%]
 
安装devep包
rpm -ivh MySQL-devel-5.6.11-1.rhel5.x86_64.rpm
Preparing...                ########################################### [100%]
   1:MySQL-devel            ########################################### [100%]
 
3. 重要的文件及目录
[root@localhost mysql]# whereis mysql
mysql: /usr/bin/mysql    /usr/include/mysql    /usr/share/mysql    /usr/share/man/man1/mysql.1.gz
 
    (1)数据库目录
   /var/lib/mysql/
(2)配置文件
   /usr/share/mysql(mysql.server命令及配置文件)
(3)相关命令
   /usr/bin(mysqladmin      mysqldump    mysqltest 等命令文件)
   (4)启动脚本
   /etc/rc.d/init.d/(mysql文件,启动脚本文件mysql的目录)
Directory Contents of Directory
/usr/bin Client programs and scripts
/usr/sbin The mysqld server
/var/lib/mysql Log files, databases
/usr/share/info Manual in Info format
/usr/share/man Unix manual pages
/usr/include/mysql Include (header) files
/usr/lib/mysql Libraries
/usr/share/mysql Miscellaneous support files, including error messages, character set files, sample configuration files, SQL for database installation
/usr/share/sql-bench Benchmarks
 
 
4. 启动mysql(普通用户也行)
service mysql start
或者
/etc/init.d/mysql start
Starting MySQL.The server quit without updating PID file (/[澶辫触]mysql/localhost.pid).  
启动 停止、重启命令
mysql: /etc/init.d/mysql start|stop|restart
 
5. 登录MySQL
   登录MySQL的命令是mysql, mysql 的使用语法如下:
   mysql [-u username] [-h host] [-p[password]] [dbname]
    #注意-p后面没有空格,直接跟着密码
 
username 与 password 分别是 MySQL 的用户名与密码,mysql的初始管理帐号是root,密码,在文件~/mysql_secret中,注意:这个root用户不是Linux的系统用户。MySQL默认用户是root。
 
在修改密码之前,什么也做不了。使用mysqladmin修改密码
[root@localhost mysql]# /usr/bin/mysqladmin -u root -p文件中的密码 password 新密码
成功的话,会出现如下的提示:
Warning: Using a password on the command line interface can be insecure.

==================================
 
到目前,mysql应该装好了,登陆进去,使用 show databases; 或者 show tables;测试下
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| test               |
+--------------------+
4 rows in set (0.00 sec)
 

声明: 此文观点不代表本站立场;转载须要保留原文链接;版权疑问请联系我们。