加入收藏 | 设为首页 | 会员中心 | 我要投稿 驾考网 (https://www.jiakaowang.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > MySql教程 > 正文

从下载到安装的 mysql 5.7 rpm方式

发布时间:2023-06-05 13:16:51 所属栏目:MySql教程 来源:
导读:杂知识点:

同步时间:

yum -y install ntp

whereis ntp

ntpdate time.nist.gov 同步时间命令,然后添加个计划任务。nist(national institut of标准技术)

crontab -e

*/10 * * * * ntpdate
杂知识点:

同步时间:

yum -y install ntp

whereis ntp

ntpdate time.nist.gov     同步时间命令,然后添加个计划任务。nist(national institut of标准技术)

crontab -e

*/10 * * * * ntpdate time.nist.gov

mysql 5.7安装:环境:mac 上的virtualBox虚拟机:NAT模式。OS:centos6.7。

wget https://dev.MysqL.com/get/Downloads/MysqL-5.7/MysqL-5.7.19-1.el6.x86_64.rpm-bundle.tar

tar -xf MysqL-5.7.19-1.el6.x86_64.rpm-bundle.tar

需要先卸载已有的MysqL:rpm -e --nodeps MysqL。。。。。rpm

按照以下顺序进行安装,因为它们之间存在依赖关系

common --> libs --> clients --> server

$ rpm -ivh MysqL-community-common-5.7.19-1.el6.x86_64.rpm
 
$ rpm -ivh MysqL-community-libs-5.7.19-1.el6.x86_64.rpm
 
$ rpm -ivh MysqL-community-clients-5.7.19-1.el6.x86_64.rpm
 
$ rpm -ivh MysqL-community-server-5.7.19-1.el6.x86_64.rpm
若出现这个错误:(这一错误我安装的时候并未遇到)

error: Failed dependencies: \
        libnuma.so.1()(64bit) is needed by MysqL-community-server-5.7.19-1.el6.x86_64 \
        libnuma.so.1(libnuma_1.1)(64bit) is needed by MysqL-community-server-5.7.19-1.el6.x86_64 \
        libnuma.so.1(libnuma_1.2)(64bit) is needed by MysqL-community-server-5.7.19-1.el6.x86_64
解决方法:

yum install -y numactl

安装完成后:

想知道安装到了哪里:

whereis MysqLd

which MysqLd

初始化MysqLd:

1、setenforce 0   关闭SELINUX,否则会报错。

2、/usr/sbin/MysqLd --user=MysqL  --datadir=/usr/local/src/MysqL5.7/

启动MysqLd:

service MysqLd start

ps -ef |grep MysqL

用MysqL客户端登录MysqLd:

MysqL -u root -p    此root跟linux系统的root没关系,是MysqLd的root用户。

如果报错:MysqL.sock 找不到,需要vim /etc/my.cnf

添加:

[MysqL]

socket=/usr/local/src/MysqL5.7/MysqL.sock

重启MysqLd服务。

注意:输入密码:5.7版本的密码会在初始化的时候,放在MysqL日志文件里,5.6是放在~./MysqL_secret文件里。从log里找到密码后,粘贴即可。

登录后,会提示:你的密码过期或者提示:你必须改密码

修改密码规则:

SHOW VARIABLES LIKE 'validate_password%';

set global validate_password_policy=0;

把规则都设为0即可,最低级密码规则也是需要4位的。

设置密码:

set password = password('123456')

查看MysqL支持的引擎:

show engines;

查看建表过程:

show create table 表名;

修改表的引擎:

ALTER TABLE engine 表名 ENGINE = INNODB;

好了,我们创建个库和表玩吧:

建库:create database myuser;

进库:use myuser;

建表:create table nason(id int(100) not null primary key auto_increment,username varchar(100) not null,password varchar(255) not null,sex int(2),age int(10),phone int(11),email varchar(100),role int(10))ENGINE=InnoDB DEFAULT CHARSET=utf8;

MysqL,使用tab补全功能,只需要修改my.cnf配置文件即可。

[MysqL]
#no-auto-rehash
auto-rehash         #添加auto-rehash

欢迎大家纠正、补充,共同进步。

(编辑:驾考网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章