在centos操作系统环境下,安装mysql真是曲折啊,动用了在线安装和离线安装,在线安装前提是有网络连接,但是我在线安装的时候,发现不少问题,总是缺少相应的包,后来采用离线安装
下载mysql,在官方下载,因为在官方下载最靠谱
以下是网址:http://dev.mysql.com/downloads/file.php?id=457682
下完之后,我的mysql名字是MySQL-5.6.25-1.linux_glibc2.5.x86_64.rpm-bundle.tar
无论手动建档还是命令行建档,能解决问题都一样
[root@localhost mysql]# rpm -qa|grep mysql
查看是否有有没有自带的mysql,如果有请卸载
首先解压软件包:利用命令行解压
第一步安装:服务端MySQL-server-5.6.25-1.linux_glibc2.5.x86_64.rpm
2. [root@localhost mysql]# rpm -ivh MySQL-server-5.6.25-1.linux_glibc2.5.x86_64.rpm
准备中... ################################# [100%]
正在升级/安装...
1:MySQL-server-5.6.25-1.linux_glibc################################# [100%]
警告:用户mysql 不存在 - 使用root
警告:群组mysql 不存在 - 使用root
2015-06-30 10:35:55 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2015-06-30 10:35:55 0 [Note] /usr/sbin/mysqld (mysqld 5.6.25) starting as process 14515 ...
2015-06-30 10:35:55 14515 [Note] InnoDB: Using atomics to ref count buffer pool pages
2015-06-30 10:35:55 14515 [Note] InnoDB: The InnoDB memory heap is disabled
2015-06-30 10:35:55 14515 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2015-06-30 10:35:55 14515 [Note] InnoDB: Memory barrier is not used
2015-06-30 10:35:55 14515 [Note] InnoDB: Compressed tables use zlib 1.2.3
2015-06-30 10:35:55 14515 [Note] InnoDB: Using Linux native AIO
2015-06-30 10:35:55 14515 [Note] InnoDB: Using CPU crc32 instructions
2015-06-30 10:35:55 14515 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2015-06-30 10:35:55 14515 [Note] InnoDB: Completed initialization of buffer pool
2015-06-30 10:35:55 14515 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2015-06-30 10:35:55 14515 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2015-06-30 10:35:55 14515 [Note] InnoDB: Database physically writes the file full: wait...
2015-06-30 10:35:55 14515 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
2015-06-30 10:35:56 14515 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
2015-06-30 10:35:56 14515 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2015-06-30 10:35:56 14515 [Warning] InnoDB: New log files created, LSN=45781
2015-06-30 10:35:56 14515 [Note] InnoDB: Doublewrite buffer not found: creating new
2015-06-30 10:35:56 14515 [Note] InnoDB: Doublewrite buffer created
2015-06-30 10:35:56 14515 [Note] InnoDB: 128 rollback segment(s) are active.
2015-06-30 10:35:56 14515 [Warning] InnoDB: Creating foreign key constraint system tables.
2015-06-30 10:35:56 14515 [Note] InnoDB: Foreign key constraint system tables created
2015-06-30 10:35:56 14515 [Note] InnoDB: Creating tablespace and datafile system tables.
2015-06-30 10:35:56 14515 [Note] InnoDB: Tablespace and datafile system tables created.
2015-06-30 10:35:56 14515 [Note] InnoDB: Waiting for purge to start
2015-06-30 10:35:57 14515 [Note] InnoDB: 5.6.25 started; log sequence number 0
A random root password has been set. You will find it in '/root/.mysql_secret'.
2015-06-30 10:35:59 14515 [Note] Binlog end
2015-06-30 10:35:59 14515 [Note] InnoDB: FTS optimize thread exiting.
2015-06-30 10:35:59 14515 [Note] InnoDB: Starting shutdown...
2015-06-30 10:36:00 14515 [Note] InnoDB: Shutdown completed; log sequence number 1625977
2015-06-30 10:36:01 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2015-06-30 10:36:01 0 [Note] /usr/sbin/mysqld (mysqld 5.6.25) starting as process 14539 ...
2015-06-30 10:36:01 14539 [Note] InnoDB: Using atomics to ref count buffer pool pages
2015-06-30 10:36:01 14539 [Note] InnoDB: The InnoDB memory heap is disabled
2015-06-30 10:36:01 14539 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2015-06-30 10:36:01 14539 [Note] InnoDB: Memory barrier is not used
2015-06-30 10:36:01 14539 [Note] InnoDB: Compressed tables use zlib 1.2.3
2015-06-30 10:36:01 14539 [Note] InnoDB: Using Linux native AIO
2015-06-30 10:36:01 14539 [Note] InnoDB: Using CPU crc32 instructions
2015-06-30 10:36:01 14539 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2015-06-30 10:36:01 14539 [Note] InnoDB: Completed initialization of buffer pool
2015-06-30 10:36:01 14539 [Note] InnoDB: Highest supported file format is Barracuda.
2015-06-30 10:36:01 14539 [Note] InnoDB: 128 rollback segment(s) are active.
2015-06-30 10:36:01 14539 [Note] InnoDB: Waiting for purge to start
2015-06-30 10:36:01 14539 [Note] InnoDB: 5.6.25 started; log sequence number 1625977
2015-06-30 10:36:01 14539 [Note] Binlog end
2015-06-30 10:36:01 14539 [Note] InnoDB: FTS optimize thread exiting.
2015-06-30 10:36:01 14539 [Note] InnoDB: Starting shutdown...
2015-06-30 10:36:02 14539 [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 at http://bugs.mysql.com/
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@localhost mysql]# netstat -nat
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 192.168.122.1:53 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN
tcp6 0 0 127.0.0.1:8005 :::* LISTEN
tcp6 0 0 :::8009 :::* LISTEN
tcp6 0 0 :::8080 :::* LISTEN
tcp6 0 0 :::22 :::* LISTEN
tcp6 0 0 ::1:631 :::* LISTEN
tcp6 0 0 ::1:25 :::* LISTEN
启动服务
[root@localhost mysql]# service mysql start
Starting MySQL. SUCCESS!
出现以上情况,说明服务端已经安装成功
第二步:安装客户端MySQL-client-5.6.25-1.linux_glibc2.5.x86_64.rpm
[root@localhost mysql]# rpm -ivh MySQL-client-5.6.25-1.linux_glibc2.5.x86_64.rpm
准备中... ################################# [100%]
正在升级/安装...
1:MySQL-client-5.6.25-1.linux_glibc################################# [100%]
出现以上情况,说明客户端已经安装成功
查看mysql是否有端口号3306
[root@localhost mysql]# netstat -ntlp | grep 3306
tcp6 0 0 :::3306 :::* LISTEN 14703/mysqld