环境centos7
根据需要下载
MySQL-client-5.6.25-1.el6.x86_64.rpm
MySQL-server-5.6.25-1.el6.x86_64.rpm
安装MySQL-server-5.6.25-1.el6.x86_64.rpm包时报如下错误
1 [root@localhost software]#rpm -ivh MySQL-server-5.6.25-1.el6.x86_64.rpm
2 准备中... ################################# [100%]
3 file /usr/share/mysql/charsets/README from install of MySQL-server-5.6.25-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_644 file /usr/share/mysql/czech/errmsg.sys from install of MySQL-server-5.6.25-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_645 file /usr/share/mysql/danish/errmsg.sys from install of MySQL-server-5.6.25-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_646 file /usr/share/mysql/dutch/errmsg.sys from install of MySQL-server-5.6.25-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_647 file /usr/share/mysql/english/errmsg.sys from install of MySQL-server-5.6.25-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_648 file /usr/share/mysql/estonian/errmsg.sys from install of MySQL-server-5.6.25-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_649 file /usr/share/mysql/french/errmsg.sys from install of MySQL-server-5.6.25-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_6410 file /usr/share/mysql/german/errmsg.sys from install of MySQL-server-5.6.25-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_6411 file /usr/share/mysql/greek/errmsg.sys from install of MySQL-server-5.6.25-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_6412 file /usr/share/mysql/hungarian/errmsg.sys from install of MySQL-server-5.6.25-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_6413 file /usr/share/mysql/italian/errmsg.sys from install of MySQL-server-5.6.25-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_6414 file /usr/share/mysql/japanese/errmsg.sys from install of MySQL-server-5.6.25-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_6415 file /usr/share/mysql/korean/errmsg.sys from install of MySQL-server-5.6.25-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_6416 file /usr/share/mysql/norwegian-ny/errmsg.sys from install of MySQL-server-5.6.25-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_6417 file /usr/share/mysql/norwegian/errmsg.sys from install of MySQL-server-5.6.25-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_6418 file /usr/share/mysql/polish/errmsg.sys from install of MySQL-server-5.6.25-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_6419 file /usr/share/mysql/portuguese/errmsg.sys from install of MySQL-server-5.6.25-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_6420 file /usr/share/mysql/romanian/errmsg.sys from install of MySQL-server-5.6.25-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_6421 file /usr/share/mysql/russian/errmsg.sys from install of MySQL-server-5.6.25-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_6422 file /usr/share/mysql/serbian/errmsg.sys from install of MySQL-server-5.6.25-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_6423 file /usr/share/mysql/slovak/errmsg.sys from install of MySQL-server-5.6.25-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_6424 file /usr/share/mysql/spanish/errmsg.sys from install of MySQL-server-5.6.25-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_6425 file /usr/share/mysql/swedish/errmsg.sys from install of MySQL-server-5.6.25-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_6426 file /usr/share/mysql/ukrainian/errmsg.sys from install of MySQL-server-5.6.25-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_6427 file /usr/share/mysql/charsets/Index.xml from install of MySQL-server-5.6.25-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_6428 file /usr/share/mysql/charsets/armscii8.xml from install of MySQL-server-5.6.25-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_6429 file /usr/share/mysql/charsets/ascii.xml from install of MySQL-server-5.6.25-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_6430 file /usr/share/mysql/charsets/cp1250.xml from install of MySQL-server-5.6.25-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_6431 file /usr/share/mysql/charsets/cp1251.xml from install of MySQL-server-5.6.25-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_6432 file /usr/share/mysql/charsets/cp1256.xml from install of MySQL-server-5.6.25-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_6433 file /usr/share/mysql/charsets/cp1257.xml from install of MySQL-server-5.6.25-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_6434 file /usr/share/mysql/charsets/cp850.xml from install of MySQL-server-5.6.25-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_6435 file /usr/share/mysql/charsets/cp852.xml from install of MySQL-server-5.6.25-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_6436 file /usr/share/mysql/charsets/cp866.xml from install of MySQL-server-5.6.25-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_6437 file /usr/share/mysql/charsets/dec8.xml from install of MySQL-server-5.6.25-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_6438 file /usr/share/mysql/charsets/geostd8.xml from install of MySQL-server-5.6.25-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_6439 file /usr/share/mysql/charsets/greek.xml from install of MySQL-server-5.6.25-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_6440 file /usr/share/mysql/charsets/hebrew.xml from install of MySQL-server-5.6.25-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_6441 file /usr/share/mysql/charsets/hp8.xml from install of MySQL-server-5.6.25-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_6442 file /usr/share/mysql/charsets/keybcs2.xml from install of MySQL-server-5.6.25-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_6443 file /usr/share/mysql/charsets/koi8r.xml from install of MySQL-server-5.6.25-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_6444 file /usr/share/mysql/charsets/koi8u.xml from install of MySQL-server-5.6.25-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_6445 file /usr/share/mysql/charsets/latin1.xml from install of MySQL-server-5.6.25-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_6446 file /usr/share/mysql/charsets/latin2.xml from install of MySQL-server-5.6.25-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_6447 file /usr/share/mysql/charsets/latin5.xml from install of MySQL-server-5.6.25-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_6448 file /usr/share/mysql/charsets/latin7.xml from install of MySQL-server-5.6.25-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_6449 file /usr/share/mysql/charsets/macce.xml from install of MySQL-server-5.6.25-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_6450 file /usr/share/mysql/charsets/macroman.xml from install of MySQL-server-5.6.25-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_6451 file /usr/share/mysql/charsets/swe7.xml from install of MySQL-server-5.6.25-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.44-2.el7.centos.x86_64
发现centos本身自带和mysql同源的mariadb数据库,使用如下命令卸载mariadb数据库
[root@localhost software]#rpm -qa|grep mariadb
mariadb-libs-5.5.44-2.el7.centos.x86_64
[root@localhost software]#rpm -e --nodeps mariadb-libs-5.5.44-2.el7.centos.x86_64
再次分别执行
[root@www software]#rpm -ivh MySQL-server-5.6.25-1.el6.x86_64.rpm
准备中... ################################# [100%]
正在升级/安装...1:MySQL-server-5.6.25-1.el6 ################################# [100%]
警告:用户mysql 不存在 -使用root
警告:群组mysql 不存在-使用root2017-01-02 15:50:47 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation formore details).2017-01-02 15:50:47 0 [Note] /usr/sbin/mysqld (mysqld 5.6.25) starting as process 2211...2017-01-02 15:50:47 2211[Note] InnoDB: Using atomics to ref count buffer pool pages2017-01-02 15:50:47 2211[Note] InnoDB: The InnoDB memory heap is disabled2017-01-02 15:50:47 2211[Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins2017-01-02 15:50:47 2211[Note] InnoDB: Memory barrier is not used2017-01-02 15:50:47 2211 [Note] InnoDB: Compressed tables use zlib 1.2.3
2017-01-02 15:50:47 2211[Note] InnoDB: Using Linux native AIO2017-01-02 15:50:47 2211[Note] InnoDB: Using CPU crc32 instructions2017-01-02 15:50:47 2211 [Note] InnoDB: Initializing buffer pool, size = 128.0M2017-01-02 15:50:47 2211[Note] InnoDB: Completed initialization of buffer pool2017-01-02 15:50:47 2211 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2017-01-02 15:50:47 2211 [Note] InnoDB: Setting file ./ibdata1 size to 12MB2017-01-02 15:50:47 2211[Note] InnoDB: Database physically writes the file full: wait...2017-01-02 15:50:47 2211 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48MB2017-01-02 15:50:49 2211 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48MB2017-01-02 15:50:49 2211 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile02017-01-02 15:50:49 2211 [Warning] InnoDB: New log files created, LSN=45781
2017-01-02 15:50:49 2211[Note] InnoDB: Doublewrite buffer not found: creating new2017-01-02 15:50:50 2211[Note] InnoDB: Doublewrite buffer created2017-01-02 15:50:50 2211 [Note] InnoDB: 128rollback segment(s) are active.2017-01-02 15:50:50 2211[Warning] InnoDB: Creating foreign key constraint system tables.2017-01-02 15:50:50 2211[Note] InnoDB: Foreign key constraint system tables created2017-01-02 15:50:50 2211[Note] InnoDB: Creating tablespace and datafile system tables.2017-01-02 15:50:50 2211[Note] InnoDB: Tablespace and datafile system tables created.2017-01-02 15:50:50 2211 [Note] InnoDB: Waiting forpurge to start2017-01-02 15:50:50 2211 [Note] InnoDB: 5.6.25 started; log sequence number 0A random root password has been set. You will find itin '/root/.mysql_secret'.2017-01-02 15:50:52 2211 [Note] Binlog end
2017-01-02 15:50:52 2211[Note] InnoDB: FTS optimize thread exiting.2017-01-02 15:50:52 2211[Note] InnoDB: Starting shutdown...2017-01-02 15:50:53 2211 [Note] InnoDB: Shutdown completed; log sequence number 1625977
2017-01-02 15:50:53 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation formore details).2017-01-02 15:50:53 0 [Note] /usr/sbin/mysqld (mysqld 5.6.25) starting as process 2233...2017-01-02 15:50:53 2233[Note] InnoDB: Using atomics to ref count buffer pool pages2017-01-02 15:50:53 2233[Note] InnoDB: The InnoDB memory heap is disabled2017-01-02 15:50:53 2233[Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins2017-01-02 15:50:53 2233[Note] InnoDB: Memory barrier is not used2017-01-02 15:50:53 2233 [Note] InnoDB: Compressed tables use zlib 1.2.3
2017-01-02 15:50:53 2233[Note] InnoDB: Using Linux native AIO2017-01-02 15:50:53 2233[Note] InnoDB: Using CPU crc32 instructions2017-01-02 15:50:53 2233 [Note] InnoDB: Initializing buffer pool, size = 128.0M2017-01-02 15:50:53 2233[Note] InnoDB: Completed initialization of buffer pool2017-01-02 15:50:54 2233[Note] InnoDB: Highest supported file format is Barracuda.2017-01-02 15:50:54 2233 [Note] InnoDB: 128rollback segment(s) are active.2017-01-02 15:50:54 2233 [Note] InnoDB: Waiting forpurge to start2017-01-02 15:50:54 2233 [Note] InnoDB: 5.6.25 started; log sequence number 1625977
2017-01-02 15:50:54 2233 [Note] Binlog end
2017-01-02 15:50:54 2233[Note] InnoDB: FTS optimize thread exiting.2017-01-02 15:50:54 2233[Note] InnoDB: Starting shutdown...2017-01-02 15:50:55 2233 [Note] InnoDB: Shutdown completed; log sequence number 1625987A RANDOM PASSWORD HAS BEEN SETFOR THE MySQL root USER !You will find that passwordin '/root/.mysql_secret'.
You must change that password on your first connect,
no other statement but 'SET PASSWORD' will be accepted.
See the manualforthe semantics of the 'password expired' flag.
Also, the accountforthe anonymous user has been removed.Inaddition, you can run:/usr/bin/mysql_secure_installation
which will also give you the option of removing the test database.
This is strongly recommendedforproduction servers.
See the manualformore 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
Newdefault config file was created as /usr/my.cnf and
will be used bydefaultby the server when you start it.
You may edit this file to change server settings
[root@www software]#rpm -ivh MySQL-client-5.6.25-1.el6.x86_64.rpm
准备中... ################################# [100%]
正在升级/安装...1:MySQL-client-5.6.25-1.el6 ################################# [100%]
安装成功后启动mysql服务
[root@www software]#systemctl start mysql.service
运行/usr/bin/mysql_secure_installation
[root@www software]#/usr/bin/mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDEDFORALL MySQL
SERVERSIN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
Inorder to log into MySQL to secure it, we'll need the current
passwordfor the root user. Ifyou've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current passwordfor root (enter fornone):
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.
You already have a root password set, so you can safely answer 'n'.
Change the root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!Reloading privilege tables..
... Success!Bydefault, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account createdforthem. This is intended onlyfortesting, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] Y
... Success!Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] Y
... Success!Bydefault, MySQL comes with a database named 'test' that anyone can
access. This is also intended onlyfortesting, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] Y-Dropping test database...
... Success!
-Removing privileges on test database...
... Success!Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] Y
... Success!All done! Ifyou've completed all of the above steps, your MySQL
installation should now be secure.
Thanksfor using MySQL!Cleaning up...
按照如上图的步骤选择自己需要移除和修改的配置,至此mysql安装成功
mysql的简单配置
[root@localhost software]#mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commandsendwith ; or \g.
Your MySQL connection id is12Server version:5.6.25 MySQL Community Server (GPL)
由于默认的root账号是只能本机登录,新增远程连接账号,为了方便,我这里新增的是远程管理员账号
mysql> create user 'admin'@'%' identified by 'admin';
Query OK,0 rows affected (0.00sec)
mysql> grant all privileges on *.* to 'admin'@'%';
Query OK,0 rows affected (0.00 sec)
这里mysql的安装和简单配置都完成
安装过程中可能会遇到如下的问题
[root@www software]#rpm -ivh MySQL-server-5.6.25-1.el6.x86_64.rpm
错误:依赖检测失败:
libaio.so.1()(64bit) 被 MySQL-server-5.6.25-1.el6.x86_64 需要
libaio.so.1(LIBAIO_0.1)(64bit) 被 MySQL-server-5.6.25-1.el6.x86_64 需要
libaio.so.1(LIBAIO_0.4)(64bit) 被 MySQL-server-5.6.25-1.el6.x86_64 需要
很明显缺少libaio包,下载(下载地址)缺少包,并且安装
[root@www software]#wget http://mirror.centos.org/centos/6/os/x86_64/Packages/libaio-0.3.107-10.el6.x86_64.rpm
--2017-01-02 15:45:21-- http://mirror.centos.org/centos/6/os/x86_64/Packages/libaio-0.3.107-10.el6.x86_64.rpm
正在解析主机 mirror.centos.org (mirror.centos.org)...213.184.126.226, 2605:9000:401:102::2正在连接 mirror.centos.org (mirror.centos.org)|213.184.126.226|:80... 已连接。
已发出 HTTP 请求,正在等待回应...200OK
长度:21708 (21K) [application/x-rpm]
正在保存至: “libaio-0.3.107-10.el6.x86_64.rpm”100%[=====================================================================================================================================================>] 21,708 59.8KB/s 用时 0.4s2017-01-02 15:45:25 (59.8 KB/s) - 已保存 “libaio-0.3.107-10.el6.x86_64.rpm” [21708/21708])
安装此rpm包即可,如下
[root@www software]#rpm -ivh libaio-0.3.107-10.el6.x86_64.rpm
警告:libaio-0.3.107-10.el6.x86_64.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID c105b9de: NOKEY
准备中...################################# [100%]
正在升级/安装...1:libaio-0.3.107-10.el6 ################################# [100%]