首页 技术 正文
技术 2022年11月20日
0 收藏 946 点赞 4,086 浏览 2096 个字

Mysql 二进制安装方法

下载mysql

https://dev.mysql.com/downloads/mysql/

1.解压包

tar xf mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz

2.实际生产环境

mv mysql-5.7.24-linux-glibc2.12-x86_64  /usr/local/mysql5.7

a.新增Mysql用户组

groupadd mysql

b. 新增用户

opt]# useradd -r -g mysql mysql

C.给mysql 目录权限

chown -R mysql:mysql mysql5.7

3. 到初始化环境的目录

Cd /home/usr/local/mysql5.6/

mkdir data

mkdir log

chown -R mysql:mysql mysql5.7

4.初始化数据和指定安装目录和数据目录

./bin/mysqld –initialize –user=mysql –basedir=/usr/local/mysql5.7/ –datadir=/usr/local/mysql5.7/data/

6复制启动文件

cp mysql.server /etc/init.d/mysqld

chmod +x /etc/init.d/mysqld

7.修改启动路径

vi /etc/init.d/mysqld

basedir= /usr/local/mysql5.7

datadir= /usr/local/mysql5.7/data

8.增加环境变量 (最下面添加)l

vi /etc/profile

export MYSQL_HOME=” /usr/local/mysql5.7″

export PATH=”$PATH:$MYSQL_HOME/bin”

9.刷新配置文件

source /etc/profile

修改配置文件

vi /etc/my.cnf

[client]

port=3306

[mysqld]

basedir=/usr/local/mysql5.7

datadir=/usr/local/mysql5.7/data

#socket=/usr/local/mysql5.7/mysql.sock

socket=/tmp/mysql.sock

user=mysql

#skip-grant-tables

# Disabling symbolic-links is recommended to prevent assorted security risks

symbolic-links=0

# Settings user and group are ignored when systemd is used.

# If you need to run mysqld under a different user or group,

# customize your systemd unit file for mariadb according to the

# instructions in http://fedoraproject.org/wiki/Systemd

[mysqld_safe]

log-error=/usr/local/mysql5.7/log/mysqld.log

pid-file=/usr/local/mysql5.7/data/mysqld.pid

#

# include all files from the config directory

#

!includedir /etc/my.cnf.d

11.添加开启自启

chkconfig –add mysqld

chkconfig mysqld on

12.启动mysqld

service mysqld start

netstat -anpt

13.修改密码(密码初始化的时候有个密码)

2018-11-02T02:07:44.574468Z 1 [Note] A temporary password is generated for root@localhost: lXyB0%fi#9-S (这个就是密码)

mysql> help contents

ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

mysql> help contents

ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

mysql> show databases;

ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

解决办法

1、 修改用户密码

mysql> alter user ‘root’@’localhost’ identified by ‘youpassword’;

或者

mysql> set password=password(“youpassword”);

2、刷新权限

mysql> flush privileges;

mysql> help contents

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,489
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,904
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,737
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,490
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:8,128
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:5,291