LAMP架构——Mysql-5.7二进制免编译安装
2017-12-15 00:28
381 查看
Mysql_5.7和Mysql_5.6差异较大
Mysql_5.7安装步骤
1.在/usr/local/src目录,下载MySQL64位的包并解压
[root@dl-001 src]# wget http://mirrors.sohu.com/mysql/MySQL-5.7/mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz [root@dl-001 src]# tar zxvf mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz
2.把解压完的数据移动到/usr/local/mysql,并进入该目录下
[root@dl-001 src]# mv mysql-5.7.17-linux-glibc2.5-x86_64 /usr/local/mysql [root@dl-001 src]# cd /usr/local/mysql
3.创建Mysql用户,并创建目录/data/mysql用来存储数据及更改属性
[root@dl-001 mysql]# useradd mysql [root@dl-001 mysql]# mkdir -p /data/mysql [root@dl-001 mysql]# chown -R mysql /data/mysql
4.初始化
[root@dl-001 mysql]# bin/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/ // 完成之后有个提示 A temporary password is generated for root@localhost: 7xYgMS,i(pne 。 后面是 root 密码。
5.cp配置文件地址
[root@dl-001 mysql]# cp support-files/mysql.server /etc/init.d/mysqld [root@dl-001 mysql]# cp support-files/my-default.cnf /etc/my.cnf
6.更改配置文件
[root@dl-001 mysql]# vim /etc/init.d/mysqld basedir=/usr/local/mysql datadir=/data/mysql [root@dl-001 mysql]# vim /etc/my.cnf basedir = /usr/local/mysql datadir = /data/mysql port = 3306 socket = /tmp/mysql.sock
7.启动
[root@dl-001 mysql]# /etc/init.d/mysqld start
设置密码
//使用初始化密码登录,进入后直接设置密码,一定要设置一下新密码 [root@dl-001 mysql]# /usr/local/mysql/bin/mysql -uroot -p'3A)¥#LkcFP' mysql: [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.7.17 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> set password = password('12#¥%6'); //设置密码 Query OK, 0 rows affected, 1 warning (0.00 sec) mysql> quit //退出 Bye
在知道初始化密码的情况下设置密码
vi /etc/my.cnf 在[mysqld]下面增加一行 skip-grant-tables 重启 /etc/init.d/mysqld restart /usr/local/mysql/bin/mysql -uroot mysql> update user set authentication_string=password('123333') where user='root'; 退出来后,更改my.cnf,去掉刚加的 skip-grant-tables 重启 /etc/init.d/mysqld restart 此时就可以使用新的密码了。
相关文章推荐
- LAMP架构——LAMP架构介绍及Mysql-5.6二进制免编译安装
- 搭建LAMP架构— 2、手工编译安装MySQL
- LAMP架构部署——编译安装MySQL
- mysql-5.7二进制预编译安装
- 分布式架构学习之:MySQL源码编译安装(CentOS-6.7+MySQL-5.6)
- CentOS 6_LAMP/LNMP--mysql的免编译安装
- CentOS6.x编译安装LAMP(3):编译安装 MySQL5.5.25
- 编译安装LAMP环境 (httpd2.4.4、mysql5.5、php5.4)
- 手动编译安装LAMP架构,并且实现nagios图形化监控(六)
- 编译安装lamp架构(基于fastcgi)
- LAMP环境安装之mysql编译报错
- ubuntu12.04下编译安装lamp(apache2.2.26 mysql5.5.36 php5.2.17)环境
- 使用源代码编译安装基于LAMP的网站架构
- CentOS 源码编译安装LAMP(Apache MySQL PHP)
- LAMP架构之使用fpm机制编译安装
- CentOS 源码编译安装LAMP(Apache MySQL PHP)
- 使用脚本进行LAMP架构源码编译安装(经多次测试可行) 推荐
- 在ubuntu linux下以编译方式安装LAMP(apache mysql php)环境
- 分布式架构高可用架构篇_06_MySQL源码编译安装(CentOS-6.7+MySQL-5.6)
- 编译安装lamp-1(mysql)