安装mysql数据库
1)选择服务器安装:
版本要求:5.6
默认安装:5.1 yum 安装mysql的默认版本
2)检查服务器自带的mysql相关安装包,并卸载
[root@bigdata01 ~]# rpm -qa | grep mysql
mysql-libs-5.1.66-2.el6_3.x86_64
[root@bigdata01 ~]# rpm -e --nodeps mysql-libs-5.1.66-2.el6_3.x86_64
[root@bigdata01 ~]# rpm -qa | grep mariadb
[root@fk02 mysql]# rpm -qa | grep mariadb mariadb-libs-5.5.56-2.el7.x86_64
[root@fk02 mysql]# rpm -e --nodeps mariadb-libs-5.5.56-2.el7.x86_64 [root@fk02 mysql]# |
|
yum方式安装
- 使用yum方式安装mysql
编译安装-都需要外网
下载mysql的yum源
- 更新mysql的yum源
[root@bigdata01 soft]# rpm -Uvh mysql57-community-release-el6-8.noarch.rpm
- 修改源
# vi /etc/yum.repos.d/mysql-community.repo
# Enable to use MySQL 5.6
[mysql56-community]
enabled=1 //改成1,表示启用
gpgcheck=1
[mysql57-community]
enabled=0 //改成0,禁用
gpgcheck=1
# vi /etc/yum.repos.d/mysql-community-source.repo
[mysql56-community-source]
enabled=1 //改成1,表示启用
gpgcheck=1
[mysql-tools-preview-source]
name=MySQL Tools Preview - Source
baseurl=http://repo.mysql.com/yum/mysql-tools-preview/el/6/SRPMS
enabled=1 //改成1,表示启用
gpgcheck=1
- 查看通过yum可以安装的软件包(只显示mysql相关的)
# yum repolist enabled | grep mysql
- yum安装mysql
# yum -y install mysql-community-server
软件包安装
执行依赖库安装
安装m4、perl、autoconf
安装m4 [root@fk01 m4]# rpm -ivh m4-1.4.16-10.el7.x86_64.rpm
安装perl [root@fk01 perl]# rpm -Uvh --force --nodeps *.rpm warning: attr-2.4.46-13.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY Preparing... ################################# [100%] Updating / installing... 1:glibc-common-2.17-260.el7_6.6 ################################# [ 0%] 2:glibc-2.17-260.el7_6.6 ################################# [ 0%] 3:perl-parent-1:0.225-244.el7 ################################# [ 1%] 4:perl-HTTP-Tiny-0.033-3.el7 ################################# [ 1%] 5:perl-podlators-2.5.1-3.el7 ################################# [ 1%] 6:perl-Pod-Perldoc-3.20-4.el7 ################################# [ 1%] 7:perl-Pod-Escapes-1:1.04-294.el7_6################################# [ 1%] 8:perl-Text-ParseWords-3.29-4.el7 ################################# [ 2%] 9:perl-Encode-2.51-7.el7 ################################# [ 2%] 10:perl-Pod-Usage-1.63-3.el7 ################################# [ 2%] 11:perl-constant-1.27-2.el7 ################################# [ 2%] 12:perl-Carp-1.26-244.el7 ################################# [ 2%] 13:perl-Exporter-5.68-3.el7 ################################# [ 3%] 14:perl-Filter-1.49-3.el7 ################################# [ 3%] 15:perl-libs-4:5.16.3-294.el7_6 ################################# [ 3%] ……. Cleaning up / removing... 501:rdma-7.3_4.7_rc2-5.el7 ################################# [ 99%] 502:pciutils-3.5.1-1.el7 ################################# [ 99%] 503:libpcap-14:1.5.3-8.el7 ################################# [ 99%] 504:fuse-libs-2.9.2-7.el7 ################################# [ 99%] 505:fuse-2.9.2-7.el7 ################################# [100%] 506:dnsmasq-2.66-21.el7 ################################# [100%] 507:cryptsetup-libs-1.7.2-1.el7 ################################# [100%] [root@fk01 perl]# ls
[root@fk01 autoconf]# rpm -ivh autoconf-2.69-11.el7.noarch.rpm warning: autoconf-2.69-11.el7.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY Preparing... ################################# [100%] Updating / installing... 1:autoconf-2.69-11.el7 ################################# [100%]
|
|
安装mysql服务
[root@fk02 mysql]# rpm -ivh MySQL-server-5.6.28-1.linux_glibc2.5.x86_64.rpm warning: MySQL-server-5.6.28-1.linux_glibc2.5.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY Preparing... ################################# [100%] Updating / installing... 1:MySQL-server-5.6.28-1.linux_glibc################################# [100%] 2019-07-19 11:00:23 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2019-07-19 11:00:23 0 [Note] /usr/sbin/mysqld (mysqld 5.6.28) starting as process 4714 ... 2019-07-19 11:00:23 4714 [Note] InnoDB: Using atomics to ref count buffer pool pages 2019-07-19 11:00:23 4714 [Note] InnoDB: The InnoDB memory heap is disabled 2019-07-19 11:00:23 4714 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 2019-07-19 11:00:23 4714 [Note] InnoDB: Memory barrier is not used 2019-07-19 11:00:23 4714 [Note] InnoDB: Compressed tables use zlib 1.2.3 2019-07-19 11:00:23 4714 [Note] InnoDB: Using Linux native AIO 2019-07-19 11:00:23 4714 [Note] InnoDB: Using CPU crc32 instructions 2019-07-19 11:00:23 4714 [Note] InnoDB: Initializing buffer pool, size = 128.0M 2019-07-19 11:00:23 4714 [Note] InnoDB: Completed initialization of buffer pool 2019-07-19 11:00:23 4714 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created! 2019-07-19 11:00:23 4714 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB 2019-07-19 11:00:23 4714 [Note] InnoDB: Database physically writes the file full: wait... 2019-07-19 11:00:23 4714 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB 2019-07-19 11:00:23 4714 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB 2019-07-19 11:00:23 4714 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0 2019-07-19 11:00:23 4714 [Warning] InnoDB: New log files created, LSN=45781 2019-07-19 11:00:23 4714 [Note] InnoDB: Doublewrite buffer not found: creating new 2019-07-19 11:00:23 4714 [Note] InnoDB: Doublewrite buffer created 2019-07-19 11:00:23 4714 [Note] InnoDB: 128 rollback segment(s) are active. 2019-07-19 11:00:23 4714 [Warning] InnoDB: Creating foreign key constraint system tables. 2019-07-19 11:00:23 4714 [Note] InnoDB: Foreign key constraint system tables created 2019-07-19 11:00:23 4714 [Note] InnoDB: Creating tablespace and datafile system tables. 2019-07-19 11:00:23 4714 [Note] InnoDB: Tablespace and datafile system tables created. 2019-07-19 11:00:23 4714 [Note] InnoDB: Waiting for purge to start 2019-07-19 11:00:23 4714 [Note] InnoDB: 5.6.28 started; log sequence number 0 A random root password has been set. You will find it in '/root/.mysql_secret'. 2019-07-19 11:00:24 4714 [Note] Binlog end 2019-07-19 11:00:24 4714 [Note] InnoDB: FTS optimize thread exiting. 2019-07-19 11:00:24 4714 [Note] InnoDB: Starting shutdown... 2019-07-19 11:00:25 4714 [Note] InnoDB: Shutdown completed; log sequence number 1625977
2019-07-19 11:00:25 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2019-07-19 11:00:25 0 [Note] /usr/sbin/mysqld (mysqld 5.6.28) starting as process 4737 ... 2019-07-19 11:00:25 4737 [Note] InnoDB: Using atomics to ref count buffer pool pages 2019-07-19 11:00:25 4737 [Note] InnoDB: The InnoDB memory heap is disabled 2019-07-19 11:00:25 4737 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 2019-07-19 11:00:25 4737 [Note] InnoDB: Memory barrier is not used 2019-07-19 11:00:25 4737 [Note] InnoDB: Compressed tables use zlib 1.2.3 2019-07-19 11:00:25 4737 [Note] InnoDB: Using Linux native AIO 2019-07-19 11:00:25 4737 [Note] InnoDB: Using CPU crc32 instructions 2019-07-19 11:00:25 4737 [Note] InnoDB: Initializing buffer pool, size = 128.0M 2019-07-19 11:00:25 4737 [Note] InnoDB: Completed initialization of buffer pool 2019-07-19 11:00:25 4737 [Note] InnoDB: Highest supported file format is Barracuda. 2019-07-19 11:00:25 4737 [Note] InnoDB: 128 rollback segment(s) are active. 2019-07-19 11:00:25 4737 [Note] InnoDB: Waiting for purge to start 2019-07-19 11:00:25 4737 [Note] InnoDB: 5.6.28 started; log sequence number 1625977 2019-07-19 11:00:25 4737 [Note] Binlog end 2019-07-19 11:00:25 4737 [Note] InnoDB: FTS optimize thread exiting. 2019-07-19 11:00:25 4737 [Note] InnoDB: Starting shutdown... 2019-07-19 11:00:27 4737 [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
WARNING: Found existing config file /usr/my.cnf on the system. Because this file might be in use, it was not replaced, but was used in bootstrap (unless you used --defaults-file) and when you later start the server. The new default config file was created as /usr/my-new.cnf, please compare it with your file and take the changes you need.
[root@fk02 mysql]#
|
|
客户端安装
[root@fk02 mysql]# rpm -ivh MySQL-client-5.6.28-1.linux_glibc2.5.x86_64.rpm warning: MySQL-client-5.6.28-1.linux_glibc2.5.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY Preparing... ################################# [100%] Updating / installing... 1:MySQL-client-5.6.28-1.linux_glibc################################# [100%] [root@fk02 mysql]#
|
|
数据库启动
启动mysql数据库的初始化
systemctl start mysql
systemctl status mysql
systemctl enable mysql
[root@fk02 mysql]# systemctl start mysql [root@fk02 mysql]# systemctl status mysql ● mysql.service - LSB: start and stop MySQL Loaded: loaded (/etc/rc.d/init.d/mysql; bad; vendor preset: disabled) Active: active (running) since Fri 2019-07-19 11:02:09 CST; 5s ago Docs: man:systemd-sysv-generator(8) Process: 4875 ExecStart=/etc/rc.d/init.d/mysql start (code=exited, status=0/SUCCESS) CGroup: /system.slice/mysql.service ├─4880 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/fk02.pid └─4983 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/lib/mysql/fk02.err --pid-file=/var/lib/mysql/fk02.pid
Jul 19 11:02:08 fk02 systemd[1]: Starting LSB: start and stop MySQL... Jul 19 11:02:09 fk02 mysql[4875]: Starting MySQL. SUCCESS! Jul 19 11:02:09 fk02 systemd[1]: Started LSB: start and stop MySQL.
[root@fk02 ~]# systemctl enable mysql mysql.service is not a native service, redirecting to /sbin/chkconfig. Executing /sbin/chkconfig mysql on |
|
首次设置
首次启动成功后,对访问用户进行设置(比如给root用户设置密码,去掉匿名用户)
# mysql_secure_installation
[root@fk02 mysql]# /usr/bin/mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MySQL to secure it, we'll need the current password for the root user. If you'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. 此处提示输入现有的mysql密码,因为首次安装, 密码是默认的,默认的密码存储在,用户目录下的.mysql_secret 此安装使用root安装,所以密码存储在/root/.mysql_secret文件中,从文件中拷贝出密码,到此处粘贴即可 Enter current password for root (enter for none):
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'.
是否修改root密码,选择y,回车,按提示输入新的密码即可 Change the root password? [Y/n] Y New password: Re-enter new password: Password updated successfully! Reloading privilege tables.. ... Success!
By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment.
(询问是否禁止匿名用户 ) Remove anonymous users? [Y/n] n ... skipping.
Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network.
(是否禁用root用户远程访问) Disallow root login remotely? [Y/n] n ... skipping.
By default, MySQL comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment.
(是否移动测试数据库) Remove test database and access to it? [Y/n] n ... skipping.
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! If you've completed all of the above steps, your MySQL installation should now be secure.
Thanks for using MySQL!
Cleaning up... [root@fk02 mysql]#
|
|
首次启动成功后,添加允许root用户远程访问,(可根据需求跳过)
mysql -uroot -p密码
update user set host = '%' where user = 'root' and host = 'localhost';
FLUSH PRIVILEGES;
[root@fk02 mysql]# mysql -uroot -pliujun Warning: Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 3 Server version: 5.6.28 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> use mysql; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A
Database changed mysql> select *from user; +-----------+------+-------------------------------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+------------+--------------+------------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+-----------------------+-----------------------+------------------+ | Host | User | Password | Select_priv | Insert_priv | Update_priv | Delete_priv | Create_priv | Drop_priv | Reload_priv | Shutdown_priv | Process_priv | File_priv | Grant_priv | References_priv | Index_priv | Alter_priv | Show_db_priv | Super_priv | Create_tmp_table_priv | Lock_tables_priv | Execute_priv | Repl_slave_priv | Repl_client_priv | Create_view_priv | Show_view_priv | Create_routine_priv | Alter_routine_priv | Create_user_priv | Event_priv | Trigger_priv | Create_tablespace_priv | ssl_type | ssl_cipher | x509_issuer | x509_subject | max_questions | max_updates | max_connections | max_user_connections | plugin | authentication_string | password_expired | +-----------+------+-------------------------------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+------------+--------------+------------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+-----------------------+-----------------------+------------------+ | localhost | root | *C15A2384C61922FBA3DA581D4AD9FF66EA0BEEB3 | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | | | | | 0 | 0 | 0 | 0 | mysql_native_password | | N | | fk02 | root | *C15A2384C61922FBA3DA581D4AD9FF66EA0BEEB3 | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | | | | | 0 | 0 | 0 | 0 | mysql_native_password | | N | | 127.0.0.1 | root | *C15A2384C61922FBA3DA581D4AD9FF66EA0BEEB3 | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | | | | | 0 | 0 | 0 | 0 | mysql_native_password | | N | | ::1 | root | *C15A2384C61922FBA3DA581D4AD9FF66EA0BEEB3 | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | | | | | 0 | 0 | 0 | 0 | mysql_native_password | | N | +-----------+------+-------------------------------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+------------+--------------+------------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+-----------------------+-----------------------+------------------+ rows in set (0.00 sec)
mysql> update user set host = '%' where user = 'root' and host = 'localhost'; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '= 'localhost'' at line 1 mysql> update user set host = '%' where user = 'root' and host = 'localhost'; Query OK, 1 row affected (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 0
mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.00 sec)
|
|
相关错误提示
[root@fk02 mysql]# rpm -ivh MySQL-server-5.6.28-1.linux_glibc2.5.x86_64.rpm warning: MySQL-server-5.6.28-1.linux_glibc2.5.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY Preparing... ################################# [100%] file /usr/share/mysql/charsets/README from install of MySQL-server-5.6.28-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.56-2.el7.x86_64 file /usr/share/mysql/czech/errmsg.sys from install of MySQL-server-5.6.28-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.56-2.el7.x86_64 file /usr/share/mysql/danish/errmsg.sys from install of MySQL-server-5.6.28-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.56-2.el7.x86_64 file /usr/share/mysql/dutch/errmsg.sys from install of MySQL-server-5.6.28-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.56-2.el7.x86_64 file /usr/share/mysql/english/errmsg.sys from install of MySQL-server-5.6.28-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.56-2.el7.x86_64 file /usr/share/mysql/estonian/errmsg.sys from install of MySQL-server-5.6.28-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.56-2.el7.x86_64 file /usr/share/mysql/french/errmsg.sys from install of MySQL-server-5.6.28-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.56-2.el7.x86_64 file /usr/share/mysql/german/errmsg.sys from install of MySQL-server-5.6.28-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.56-2.el7.x86_64 file /usr/share/mysql/greek/errmsg.sys from install of MySQL-server-5.6.28-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.56-2.el7.x86_64 file /usr/share/mysql/hungarian/errmsg.sys from install of MySQL-server-5.6.28-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.56-2.el7.x86_64 file /usr/share/mysql/italian/errmsg.sys from install of MySQL-server-5.6.28-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.56-2.el7.x86_64 file /usr/share/mysql/japanese/errmsg.sys from install of MySQL-server-5.6.28-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.56-2.el7.x86_64 file /usr/share/mysql/korean/errmsg.sys from install of MySQL-server-5.6.28-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.56-2.el7.x86_64 file /usr/share/mysql/norwegian-ny/errmsg.sys from install of MySQL-server-5.6.28-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.56-2.el7.x86_64 file /usr/share/mysql/norwegian/errmsg.sys from install of MySQL-server-5.6.28-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.56-2.el7.x86_64 file /usr/share/mysql/polish/errmsg.sys from install of MySQL-server-5.6.28-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.56-2.el7.x86_64 file /usr/share/mysql/portuguese/errmsg.sys from install of MySQL-server-5.6.28-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.56-2.el7.x86_64 file /usr/share/mysql/romanian/errmsg.sys from install of MySQL-server-5.6.28-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.56-2.el7.x86_64 file /usr/share/mysql/russian/errmsg.sys from install of MySQL-server-5.6.28-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.56-2.el7.x86_64 file /usr/share/mysql/serbian/errmsg.sys from install of MySQL-server-5.6.28-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.56-2.el7.x86_64 file /usr/share/mysql/slovak/errmsg.sys from install of MySQL-server-5.6.28-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.56-2.el7.x86_64 file /usr/share/mysql/spanish/errmsg.sys from install of MySQL-server-5.6.28-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.56-2.el7.x86_64 file /usr/share/mysql/swedish/errmsg.sys from install of MySQL-server-5.6.28-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.56-2.el7.x86_64 file /usr/share/mysql/ukrainian/errmsg.sys from install of MySQL-server-5.6.28-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.56-2.el7.x86_64 file /usr/share/mysql/charsets/Index.xml from install of MySQL-server-5.6.28-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.56-2.el7.x86_64 file /usr/share/mysql/charsets/armscii8.xml from install of MySQL-server-5.6.28-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.56-2.el7.x86_64 file /usr/share/mysql/charsets/ascii.xml from install of MySQL-server-5.6.28-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.56-2.el7.x86_64 file /usr/share/mysql/charsets/cp1250.xml from install of MySQL-server-5.6.28-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.56-2.el7.x86_64 file /usr/share/mysql/charsets/cp1251.xml from install of MySQL-server-5.6.28-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.56-2.el7.x86_64 file /usr/share/mysql/charsets/cp1256.xml from install of MySQL-server-5.6.28-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.56-2.el7.x86_64 file /usr/share/mysql/charsets/cp1257.xml from install of MySQL-server-5.6.28-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.56-2.el7.x86_64 file /usr/share/mysql/charsets/cp850.xml from install of MySQL-server-5.6.28-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.56-2.el7.x86_64 file /usr/share/mysql/charsets/cp852.xml from install of MySQL-server-5.6.28-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.56-2.el7.x86_64 file /usr/share/mysql/charsets/cp866.xml from install of MySQL-server-5.6.28-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.56-2.el7.x86_64 file /usr/share/mysql/charsets/dec8.xml from install of MySQL-server-5.6.28-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.56-2.el7.x86_64 file /usr/share/mysql/charsets/geostd8.xml from install of MySQL-server-5.6.28-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.56-2.el7.x86_64 file /usr/share/mysql/charsets/greek.xml from install of MySQL-server-5.6.28-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.56-2.el7.x86_64 file /usr/share/mysql/charsets/hebrew.xml from install of MySQL-server-5.6.28-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.56-2.el7.x86_64 file /usr/share/mysql/charsets/hp8.xml from install of MySQL-server-5.6.28-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.56-2.el7.x86_64 file /usr/share/mysql/charsets/keybcs2.xml from install of MySQL-server-5.6.28-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.56-2.el7.x86_64 file /usr/share/mysql/charsets/koi8r.xml from install of MySQL-server-5.6.28-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.56-2.el7.x86_64 file /usr/share/mysql/charsets/koi8u.xml from install of MySQL-server-5.6.28-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.56-2.el7.x86_64 file /usr/share/mysql/charsets/latin1.xml from install of MySQL-server-5.6.28-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.56-2.el7.x86_64 file /usr/share/mysql/charsets/latin2.xml from install of MySQL-server-5.6.28-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.56-2.el7.x86_64 file /usr/share/mysql/charsets/latin5.xml from install of MySQL-server-5.6.28-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.56-2.el7.x86_64 file /usr/share/mysql/charsets/latin7.xml from install of MySQL-server-5.6.28-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.56-2.el7.x86_64 file /usr/share/mysql/charsets/macce.xml from install of MySQL-server-5.6.28-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.56-2.el7.x86_64 file /usr/share/mysql/charsets/macroman.xml from install of MySQL-server-5.6.28-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.56-2.el7.x86_64 file /usr/share/mysql/charsets/swe7.xml from install of MySQL-server-5.6.28-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.56-2.el7.x86_64
此错误为机器已经安装了mariadb, 此数据库与mysql为同一类型,mariadb为开源版本,需要卸载
错误2 [root@fk02 mysql]# rpm -ivh MySQL-server-5.6.28-1.linux_glibc2.5.x86_64.rpm warning: MySQL-server-5.6.28-1.linux_glibc2.5.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY Preparing... ################################# [100%] Updating / installing... 1:MySQL-server-5.6.28-1.linux_glibc################################# [100%] warning: user mysql does not exist - using root warning: group mysql does not exist - using root FATAL ERROR: please install the following Perl modules before executing /usr/bin/mysql_install_db: Data::Dumper
解决方法是安装autoconf库 yum -y install autoconf
[root@fk02 mysql]# rpm -e MySQL-server-5.6.28-1.linux_glibc2.5.x86_64 [root@fk02 mysql]# yum -y install autoconf Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.163.com * extras: mirrors.aliyun.com * updates: mirrors.163.com base | 3.6 kB 00:00:00 extras | 3.4 kB 00:00:00 updates | 3.4 kB 00:00:00 updates/7/x86_64/primary_db | 6.5 MB 00:00:01 Resolving Dependencies --> Running transaction check ---> Package autoconf.noarch 0:2.69-11.el7 will be installed --> Processing Dependency: m4 >= 1.4.14 for package: autoconf-2.69-11.el7.noarch --> Processing Dependency: perl(Data::Dumper) for package: autoconf-2.69-11.el7.noarch --> Running transaction check ---> Package m4.x86_64 0:1.4.16-10.el7 will be installed ---> Package perl-Data-Dumper.x86_64 0:2.145-3.el7 will be installed --> Finished Dependency Resolution
Dependencies Resolved
================================================================================================================================================================================================================= Package Arch Version Repository Size ================================================================================================================================================================================================================= Installing: autoconf noarch 2.69-11.el7 base 701 k Installing for dependencies: m4 x86_64 1.4.16-10.el7 base 256 k perl-Data-Dumper x86_64 2.145-3.el7 base 47 k
Transaction Summary ================================================================================================================================================================================================================= Install 1 Package (+2 Dependent packages)
Total download size: 1.0 M Installed size: 2.8 M Downloading packages: (1/3): m4-1.4.16-10.el7.x86_64.rpm | 256 kB 00:00:00 (2/3): perl-Data-Dumper-2.145-3.el7.x86_64.rpm | 47 kB 00:00:00 (3/3): autoconf-2.69-11.el7.noarch.rpm | 701 kB 00:00:00 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Total 2.5 MB/s | 1.0 MB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Warning: RPMDB altered outside of yum. ** Found 2 pre-existing rpmdb problem(s), 'yum check' output follows: 2:postfix-2.10.1-6.el7.x86_64 has missing requires of libmysqlclient.so.18()(64bit) 2:postfix-2.10.1-6.el7.x86_64 has missing requires of libmysqlclient.so.18(libmysqlclient_18)(64bit) Installing : m4-1.4.16-10.el7.x86_64 1/3 Installing : perl-Data-Dumper-2.145-3.el7.x86_64 2/3 Installing : autoconf-2.69-11.el7.noarch 3/3 Verifying : perl-Data-Dumper-2.145-3.el7.x86_64 1/3 Verifying : m4-1.4.16-10.el7.x86_64 2/3 Verifying : autoconf-2.69-11.el7.noarch 3/3
Installed: autoconf.noarch 0:2.69-11.el7
Dependency Installed: m4.x86_64 0:1.4.16-10.el7 perl-Data-Dumper.x86_64 0:2.145-3.el7
Complete! [root@fk02 mysql]#
如发生错误建议卸载重新安装 [root@fk02 lib]# rpm -qa |grep MySQL MySQL-client-5.6.28-1.linux_glibc2.5.x86_64 MySQL-server-5.6.28-1.linux_glibc2.5.x86_64 [root@fk02 lib]# rm -e MySQL-server-5.6.28-1.linux_glibc2.5.x86_64 rm: invalid option -- 'e' Try 'rm --help' for more information. [root@fk02 lib]# rpm -e MySQL-server-5.6.28-1.linux_glibc2.5.x86_64 [root@fk02 lib]# rpm -e MySQL-client-5.6.28-1.linux_glibc2.5.x86_64 [root@fk02 mysql]# rm -rf /usr/lib64/mysql [root@fk02 mysql]# rm -rf /var/lib/mysql [root@fk02 mysql]# rm -rf /etc/my.cnf [root@fk02 mysql]# rm -rf /var/log/mysqld.log [root@fk02 mysql]# |
|