Centos7 install mysql5.7.1

I bought an Alibaba Cloud server in the past two days to play

First install jdk, tomcat, this is relatively simple



Then modify the configuration file profile in etc.

add on the last line

 

JAVA_HOME=/usr/local/java/jdk1.7.0_76
PATH=$JAVA_HOME/bin:/sbin:/usr/bin:/usr/sbin:$PATH
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export JAVA_HOME
export PATH
export CLASSPATH
export TOMCAT_HOME=/usr/local/java/tomcat

 

 

Then execute source /etc/profile and it will be ok

Execute java -version to view the jdk version

 

The following mainly talks about the installation of mysql

This really took a lot of effort. I started to download mysql.tar.gz and installed it. As a result, various errors occurred. Baidu has been modifying various files. In the end, I still reported some pid errors, so I gave up decisively after a day.

 

Now download the rpm file from the mysql official website 

Uninstall mariadb-lib before installing

 

 

[root@5201351 ~]# rpm -qa|grep mariadb
mariadb-libs-5.5.41-2.el7_0.x86_64
[root@5201351 ~]# rpm -e mariadb-libs-5.5.41-2.el7_0.x86_64 --nodeps

 

 Go to mysql's official website to download the latest version of mysql's rpm collection package



 It's a 550M package

Then tar -xf the bundle.tar package

 

After getting the following rpm packages, we mainly use four community-libs, community-common, community-client, community-server

We install it one by one, using rpm -ivh to install

 

When installing, you may encounter 

libaio.so.1: cannot open shared object file: No such file or directory 这样的问题

可以yum install libaio* 来解决 ,如果还是不行,直接在安装命令的后面加--nodeps --force 解决依赖 强制装

可以解决

 

四个安装好了之后 执行

# mysqld --initialize

 会在/var/log/mysqld.log生成随机密码



 

找到自动生成的密码

更改mysql数据库目录的所属用户及其所属组,然后启动mysql数据库

[root@5201351 ~]# chown mysql:mysql /var/lib/mysql -R
[root@5201351 ~]# systemctl start mysqld.service  

 

根据之前的密码登录到mysql,更改root用户的密码,新版的mysql在第一次登录后更改密码前是不能执行任何命令的

 

 

[root@5201351 ~]# mysql -uroot -p'ij+xyCYm:9&X'
mysql> set password=password('root');

 

此时mysql 已经安装好了,并且有了一个用户名为root,密码也为root的用户

 

若要在自己的客户端远程登录 则还要赋权限,因为它默认只能本机登录



 根据上面的步骤,或者自己直接百度就ok

 

若不详细的话   建议大家看一下http://www.cnblogs.com/softidea/p/5270330.html

我就是根据这个链接来安装成功的

 

 

 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326126891&siteId=291194637