Mysql安装
1.检测系统是否自带安装mysql
yum list installed | grep mysql
2.删除系统自带mysql,删除(所有以mysql开头的都删除)
yum remove mysql mysql-server mysql-libs
3.下载mysql5.7 rpm包
wget http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm
4.执行rpm
rpm -ivh mysql-community-release-el6-5.noarch.rpm
5.安装mysql 服务器命令(一路yes)
yum install mysql-community-server
6.启动mysql服务
service mysqld start
其他步骤设置密码,开机自动启动,开启mysql外网访问就。。。。。
按着步骤来走到第六步出错:
service mysqld start
mysqld: unrecognized service
然后回看自己前面执行的代码发现第五步执行过程有错误:
Downloading Packages:
(1/5): mysql-community-client-5.6.45-2.el6.x86_64.rpm | 18 MB 00:32
http://repo.mysql.com/yum/mysql-5.6-community/el/6/x86_64/mysql-community-common-5.6.45-2.el6.x86_64.rpm: [Errno 14] PYCURL ERROR 52 - "Empty reply from server"
Trying other mirror.
(3/5): mysql-community-libs-5.6.45-2.el6.x86_64.rpm | 1.9 MB 00:02
(4/5): mysql-community-server-5.6.45-2.el6.x86_64.rpm | 55 MB 01:48
(5/5): perl-DBI-1.609-4.el6.x86_64.rpm | 705 kB 00:01
Error Downloading Packages:
mysql-community-common-5.6.45-2.el6.x86_64: failure: mysql-community-common-5.6.45-2.el6.x86_64.rpm from mysql56-community: [Errno 256] No more mirrors to try.
通过百度翻译原来是下载出了问题。此时检查下linux虚拟机是否联网,可以打开百度搜搜东西,同时在再次执行第五步下载。
正在下载包:
(1/5):mysql-community-client-5.6.45-2.el6.x86_.rpm 18 MB 00:32
http://repo.mysql.com/yum/mysql-5.6-community/el/6/x86_64/mysql-community-common-5.6.45-2.el6.x86_64.rpm:[errno 14]pycurl错误52-“从服务器空回复”
尝试其他镜像。
(3/5):mysql-community-libs-5.6.45-2.el6.x86_.rpm 1.9 MB 00:02
(4/5):mysql-community-server-5.6.45-2.el6.x86_.rpm_55 MB 01:48
(5/5):perl-dbi-1.609-4.el6.x86_.rpm_705 kb 00:01
下载包时出错:
mysql-community-common-5.6.45-2.el6.x86_64:失败:mysql-community-common-5.6.45-2.el6.x86_64.rpm来自mysql56 community:[errno 256]没有更多镜像可供尝试。
这里是执行的第五步代码,看见Complete!执行成功。
[root@localhost bin]# yum install mysql-community-server
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: mirror.jdcloud.com
* extras: mirror.jdcloud.com
* updates: mirror.jdcloud.com
Resolving Dependencies
--> Running transaction check
---> Package mysql-community-server.x86_64 0:5.6.45-2.el6 will be installed
--> Processing Dependency: mysql-community-common(x86-64) = 5.6.45-2.el6 for package: mysql-community-server-5.6.45-2.el6.x86_64
--> Processing Dependency: mysql-community-client(x86-64) >= 5.6.10 for package: mysql-community-server-5.6.45-2.el6.x86_64
--> Processing Dependency: perl(DBI) for package: mysql-community-server-5.6.45-2.el6.x86_64
--> Running transaction check
---> Package mysql-community-client.x86_64 0:5.6.45-2.el6 will be installed
--> Processing Dependency: mysql-community-libs(x86-64) >= 5.6.10 for package: mysql-community-client-5.6.45-2.el6.x86_64
---> Package mysql-community-common.x86_64 0:5.6.45-2.el6 will be installed
---> Package perl-DBI.x86_64 0:1.609-4.el6 will be installed
--> Running transaction check
---> Package mysql-community-libs.x86_64 0:5.6.45-2.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
====================================================================================================
Package Arch Version Repository Size
====================================================================================================
Installing:
mysql-community-server x86_64 5.6.45-2.el6 mysql56-community 55 M
Installing for dependencies:
mysql-community-client x86_64 5.6.45-2.el6 mysql56-community 18 M
mysql-community-common x86_64 5.6.45-2.el6 mysql56-community 309 k
mysql-community-libs x86_64 5.6.45-2.el6 mysql56-community 1.9 M
perl-DBI x86_64 1.609-4.el6 base 705 k
Transaction Summary
====================================================================================================
Install 5 Package(s)
Total size: 76 M
Total download size: 309 k
Installed size: 338 M
Is this ok [y/N]: y
Downloading Packages:
mysql-community-common-5.6.45-2.el6.x86_64.rpm | 309 kB 00:00
warning: rpmts_HdrFromFdno: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Retrieving key from file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Importing GPG key 0x5072E1F5:
Userid : MySQL Release Engineering <mysql-build@oss.oracle.com>
Package: mysql-community-release-el6-5.noarch (installed)
From : file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Is this ok [y/N]: y
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID c105b9de: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Importing GPG key 0xC105B9DE:
Userid : CentOS-6 Key (CentOS 6 Official Signing Key) <centos-6-key@centos.org>
Package: centos-release-6-7.el6.centos.12.3.x86_64 (@anaconda-CentOS-201508042137.x86_64/6.7)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
Installing : mysql-community-common-5.6.45-2.el6.x86_64 1/5
Installing : mysql-community-libs-5.6.45-2.el6.x86_64 2/5
Installing : mysql-community-client-5.6.45-2.el6.x86_64 3/5
Installing : perl-DBI-1.609-4.el6.x86_64 4/5
Installing : mysql-community-server-5.6.45-2.el6.x86_64 5/5
Verifying : mysql-community-client-5.6.45-2.el6.x86_64 1/5
Verifying : mysql-community-libs-5.6.45-2.el6.x86_64 2/5
Verifying : mysql-community-common-5.6.45-2.el6.x86_64 3/5
Verifying : mysql-community-server-5.6.45-2.el6.x86_64 4/5
Verifying : perl-DBI-1.609-4.el6.x86_64 5/5
Installed:
mysql-community-server.x86_64 0:5.6.45-2.el6
Dependency Installed:
mysql-community-client.x86_64 0:5.6.45-2.el6 mysql-community-common.x86_64 0:5.6.45-2.el6
mysql-community-libs.x86_64 0:5.6.45-2.el6 perl-DBI.x86_64 0:1.609-4.el6
Complete!
执行第六步:
service mysqld start
Initializing MySQL database: 2019-09-02 09:53:38 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2019-09-02 09:53:38 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
2019-09-02 09:53:38 0 [Note] /usr/sbin/mysqld (mysqld 5.6.45) starting as process 3587 ...
2019-09-02 09:53:38 3587 [Note] InnoDB: Using atomics to ref count buffer pool pages
2019-09-02 09:53:38 3587 [Note] InnoDB: The InnoDB memory heap is disabled
2019-09-02 09:53:38 3587 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2019-09-02 09:53:38 3587 [Note] InnoDB: Memory barrier is not used
2019-09-02 09:53:38 3587 [Note] InnoDB: Compressed tables use zlib 1.2.11
2019-09-02 09:53:38 3587 [Note] InnoDB: Using Linux native AIO
2019-09-02 09:53:38 3587 [Note] InnoDB: Using CPU crc32 instructions
2019-09-02 09:53:38 3587 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2019-09-02 09:53:39 3587 [Note] InnoDB: Completed initialization of buffer pool
2019-09-02 09:53:39 3587 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2019-09-02 09:53:39 3587 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2019-09-02 09:53:39 3587 [Note] InnoDB: Database physically writes the file full: wait...
2019-09-02 09:53:39 3587 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
2019-09-02 09:53:39 3587 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
2019-09-02 09:53:39 3587 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2019-09-02 09:53:39 3587 [Warning] InnoDB: New log files created, LSN=45781
2019-09-02 09:53:39 3587 [Note] InnoDB: Doublewrite buffer not found: creating new
2019-09-02 09:53:39 3587 [Note] InnoDB: Doublewrite buffer created
2019-09-02 09:53:39 3587 [Note] InnoDB: 128 rollback segment(s) are active.
2019-09-02 09:53:39 3587 [Warning] InnoDB: Creating foreign key constraint system tables.
2019-09-02 09:53:39 3587 [Note] InnoDB: Foreign key constraint system tables created
2019-09-02 09:53:39 3587 [Note] InnoDB: Creating tablespace and datafile system tables.
2019-09-02 09:53:39 3587 [Note] InnoDB: Tablespace and datafile system tables created.
2019-09-02 09:53:39 3587 [Note] InnoDB: Waiting for purge to start
2019-09-02 09:53:39 3587 [Note] InnoDB: 5.6.45 started; log sequence number 0
2019-09-02 09:53:40 3587 [Note] Binlog end
2019-09-02 09:53:40 3587 [Note] InnoDB: FTS optimize thread exiting.
2019-09-02 09:53:40 3587 [Note] InnoDB: Starting shutdown...
2019-09-02 09:53:41 3587 [Note] InnoDB: Shutdown completed; log sequence number 1625977
2019-09-02 09:53:41 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2019-09-02 09:53:41 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
2019-09-02 09:53:41 0 [Note] /usr/sbin/mysqld (mysqld 5.6.45) starting as process 3609 ...
2019-09-02 09:53:41 3609 [Note] InnoDB: Using atomics to ref count buffer pool pages
2019-09-02 09:53:41 3609 [Note] InnoDB: The InnoDB memory heap is disabled
2019-09-02 09:53:41 3609 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2019-09-02 09:53:41 3609 [Note] InnoDB: Memory barrier is not used
2019-09-02 09:53:41 3609 [Note] InnoDB: Compressed tables use zlib 1.2.11
2019-09-02 09:53:41 3609 [Note] InnoDB: Using Linux native AIO
2019-09-02 09:53:41 3609 [Note] InnoDB: Using CPU crc32 instructions
2019-09-02 09:53:41 3609 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2019-09-02 09:53:41 3609 [Note] InnoDB: Completed initialization of buffer pool
2019-09-02 09:53:41 3609 [Note] InnoDB: Highest supported file format is Barracuda.
2019-09-02 09:53:41 3609 [Note] InnoDB: 128 rollback segment(s) are active.
2019-09-02 09:53:41 3609 [Note] InnoDB: Waiting for purge to start
2019-09-02 09:53:41 3609 [Note] InnoDB: 5.6.45 started; log sequence number 1625977
2019-09-02 09:53:41 3609 [Note] Binlog end
2019-09-02 09:53:41 3609 [Note] InnoDB: FTS optimize thread exiting.
2019-09-02 09:53:41 3609 [Note] InnoDB: Starting shutdown...
2019-09-02 09:53:43 3609 [Note] InnoDB: Shutdown completed; log sequence number 1625987
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h localhost.localdomain password 'new-password'
Alternatively you can run:
/usr/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. 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
Note: new default config file not created.
Please make sure your config file is current
WARNING: Default config file /etc/my.cnf exists on the system
This file will be read by default by the MySQL server
If you do not want to use this, either remove it, or use the
--defaults-file argument to mysqld_safe when starting the server
[ OK ]
Starting mysqld: [ OK ]
怕不对,又执行第六步了一遍。
bin]# service mysqld start
Starting mysqld: [ OK ]
稍微吐槽一下:就着一个问题,弄了两天,原来是linux待机时间长,网不好的问题导致的(猜测哈,因为实验次数不多)。