#CentOS7安装MySQLnode
1.安装前准备mysql
1)下载地址:https://downloads.mysql.com/archives/community/sql
2)卸载系统自带的mariaDB数据库
[root@cdhmaster Desktop]# rpm -qa|grep mariadbcentos
mariadb-libs-5.5.44-2.el7.centos.x86_64.net
[root@cdhmaster Desktop]# rpm -e --nodeps mariadb-libs-5.5.44-2.el7.centos.x86_64orm
3)安装autoconf包server
yum -y install autoconf //此包安装时会安装Data:Dumper模块blog
不安装此包安装mysql时会报以下错:ci
FATAL ERROR: please install the following Perl modules before executing /usr/bin/mysql_install_db:
Data::Dumper
2.安装及配置过程
1)解压、安装
[root@cdhmaster mysql]# tar -xvf MySQL-5.6.35-1.el7.x86_64.rpm-bundle.tar
MySQL-server-5.6.35-1.el7.x86_64.rpm
MySQL-client-5.6.35-1.el7.x86_64.rpm
MySQL-shared-compat-5.6.35-1.el7.x86_64.rpm
MySQL-shared-5.6.35-1.el7.x86_64.rpm
MySQL-devel-5.6.35-1.el7.x86_64.rpm
MySQL-test-5.6.35-1.el7.x86_64.rpm
MySQL-embedded-5.6.35-1.el7.x86_64.rpm
[root@cdhmaster mysql]# rpm -ivh MySQL-*.rpmwarning: MySQL-client-5.6.35-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:MySQL-devel-5.6.35-1.el7 ################################# [ 14%]
2:MySQL-client-5.6.35-1.el7 ################################# [ 29%]
3:MySQL-test-5.6.35-1.el7 ################################# [ 43%]
4:MySQL-embedded-5.6.35-1.el7 ################################# [ 57%]
5:MySQL-shared-compat-5.6.35-1.el7 ################################# [ 71%]
6:MySQL-shared-5.6.35-1.el7 ################################# [ 86%]
7:MySQL-server-5.6.35-1.el7 ################################# [100%]
2)启动数据库
[root@cdhmaster mysql]# /usr/bin/mysql_install_db
Installing MySQL system tables...2017-12-21 14:41:27 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
...
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 cdhmaster password 'new-password'
...
启动mysql服务
[root@cdhmaster mysql]# service mysql start
Starting MySQL. SUCCESS!
[root@cdhmaster mysql]#
配置root密码
[root@cdhmaster mysql]# mysqladmin -u root password '你的密码'
Warning: Using a password on the command line interface can be insecure.
这样就配置完了,就能够用mysql -uroot -p登陆了,以下所示:
[root@cdhmaster mysql]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.6.35 MySQL Community Server (GPL)
Copyright (c) 2000, 2016, 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> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema || mysql || performance_schema || test |
+--------------------+
4 rows in set (0.00 sec)
mysql>
能够经过如下命令设置mysql服务开机自启动:
chkconfig mysql on
遇到的问题解决连接:http://blog.csdn.net/vurtne_ye/article/details/26514499
http://blog.csdn.net/rogerzhanglijie/article/details/9182125