转载linux错误报告

这里写自定义目录标题


转载https://www.360kuai.com/pc/9e589887088603a01?cota=4&kuai_so=1&tj_url=so_rec&sign=360_57c3bbd1&refer_scene=so_1
搭建项目用mysql数据库,话不多说.

1.官网下载好mysql二进制文件

Mysql官方下载

2,将下载好的文件上传至服务器, /usr/local

执行解压缩 : tar -xvf XX.tar.xz

重命名文件夹: mv XX mysql

3.添加系统用户组和用户: groupadd mysql和useradd -r -g mysql mysql

进入文件夹: cd mysql

此时当前目录为: /usr/local/mysql

4.新建数据目录个临时目录: mkdir data tmp

配置相应权限:chmod 777 ./data ./tmp

新建并修改配置文件:

cd support-files

touch  my-default.cnf

vim  my-default.cnf 

将以下内容写入文件,其中lower_case_table_names=1 表示忽略大小写敏感

[mysqld]

basedir = /usr/local/mysql

datadir = /usr/local/mysql/data

port = 3306

socket = /usr/local/mysql/tmp/mysql.sock

lower_case_table_names=1

[client]

default-character-set=utf8

socket= /usr/local/mysql/tmp/mysql.sock

[mysql]

default-character-set=utf8

socket= /usr/local/mysql/tmp/mysql.sock

  1. 修改当前目录为mysql用户: chown -R mysql:mysql ./

初始化Mysql配置表: cd …(执行结束,当前目录为/usr/local/mysql)

bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data

执行结束会生成数据库root用户密码:

2019-10-10T10:02:45.666654Z 0 [System] [MY-013169] [Server] /usr/local/mysql/bin/mysqld (mysqld 8.0.16) initializing of server in progress as process 40212

2019-10-10T10:02:47.687058Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost:gjbdRs ir7e*

2019-10-10T10:02:48.832168Z 0 [System] [MY-013170] [Server] /usr/local/mysql/bin/mysqld (mysqld 8.0.16) initializing of server has completed

如果执行失败,需要删除data 和tmp文件下所有内容,检查配置后重新执行初始化

6.设置开机启动服务

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

chmod x /etc/init.d/mysql

chkconfig --add mysql

检查是否启动成功:chkconfig --list mysql

Note: This output shows SysV services only and does not include native systemd services. SysV configuration data might be overridden by native systemd configuration. If you want to list systemd services use ‘systemctl list-unit-files’. To see services enabled on particular target use ‘systemctl list-dependencies [target]’.

mysql 0:off 1:off 2:on 3:on 4:on 5:on 6:off

以上即成功.

7.手动启动服务

service mysql start (此处可用start,stop,restart命令)

配置环境变量:

vim /etc/profile

追加内容:

export PATH=$PATH:/usr/local/mysql/bin:/usr/local/mysql/lib

保存退出后,source /etc/profile 使文件生效

8.登录Mysql,重置密码

mysql -uroot -p gjbdRs ir7e* (密码是上面生成的密码,如果有括号,可能会有报错,我重新执行的初始化)

alter user ‘root’@‘localhost’ identified by ‘root’;(重置为root)

flush privileges;

如果登录报错:

mysql: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory

执行: locate libtinfo.so.5

yum install libncurses*

安装完成,重新连接mysql;

9.设置远程navicat连接

首先确保防火墙关闭,或者端口放行.自行查找解决.

mysql->use mysql;

mysql->update user set host = ‘%’ where user =‘root’;

mysql->flush privileges;

mysql->select ‘host’ from user where user=‘root’;

10.用navicat 连接使用.

好用给个赞赏吧Alt

带尺寸的图片: Alt

居中的图片: Alt

居中并且带尺寸的图片: Alt

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值