linux安装mysql8.0

1:解压

tar zxvf mysql-8.0.20-el7-x86_64.tar.gz

2:移动并重命名

mv mysql-8.0.20-el7-x86_64 my8.0 

mv mysql8.0 /usr/local/

3:创建data文件夹

mkdir data

4:设置权限

 groupadd mysql
 useradd -g mysql mysql
 chown -R mysql.mysql /usr/local/mysql8.0/

5:编译


./bin/mysqld --user=mysql --basedir=/usr/local/mysql8.0/ --datadir=/usr/local/mysql8.0/data/ --initialize  --lower-case-table-names=1

6 :建立MySQL服务

cp -a ./support-files/mysql.server /etc/init.d/mysql
chmod +x /etc/init.d/mysql
chkconfig --add mysql
chkconfig --list mysql

ln -s /usr/local/mysql/bin/mysql /usr/bin

删除软连接 :rm /usr/bin/mysql  如果提示存在了,才删除

7:启动

 service mysql start

8:查看状态

 service mysql status

9:登录 修改密码

mysql -uroot -p

use mysql;

ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'root';

FLUSH PRIVILEGES;

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION ;

FLUSH PRIVILEGES;

10:其他

10.1设置允许远程登录 :

  select user,authentication_string,host from user;

 CREATE USER 'root'@'%' IDENTIFIED BY '你的密码';

 flush privileges;

10.2磁盘空间太小,导致编译失败

du -sh *  删除不必要的文件

10.3忘记密码

1:找到/etc/my.cnf文件,进入到文件中放开skip-grant-tables

登录后,修改密码,再删掉此配置

10.4卸载mysql

rpm -qa|grep -i mysql

find / -name mysql

删除对应的文件夹

10.5 查询mysql的配置文件在哪里

/usr/local/mysql/bin/mysqld --verbose --help |grep -A 1 'Default options'

my.cnf 配置文件 

[mysqld]
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
default_authentication_plugin=mysql_native_password
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove the leading "# " to disable binary logging
# Binary logging captures changes between backups and is enabled by
# default. It's default setting is log_bin=binlog
# disable_log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
#
# Remove leading # to revert to previous value for default_authentication_plugin,
# this will increase compatibility with older clients. For background, see:
# https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_default_authentication_plugin
# default-authentication-plugin=mysql_native_password

lower_case_table_names=1
datadir=/usr/local/mysql/data
#socket=/usr/local/mysql/mysql.sock
log-error=/var/log/mysqld.log
# pid-file=/usr/local/mysqld/mysqld.pid
server-id=2
log_bin=mysql-bin
replicate-do-db=saas_dkp_prod
replicate-ignore-db=mysql
slave-skip-errors = all
slow_query_log=1
slow-query-log-file=/var/log/mysql-slow.log
long_query_time=1
max_connections=5000

10.6 mysql错误日志查看

Starting MySQL.. ERROR! The server quit without updating PID file (/usr/local/mysql/data/VM-12-16-centos.pid).

错误日志 为 /usr/local/mysql/data/VM-12-16-centos.err

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值