linux安装mysql 5.7-凯发app官方网站

凯发app官方网站-凯发k8官网下载客户端中心 | | 凯发app官方网站-凯发k8官网下载客户端中心
  • 博客访问: 2229168
  • 博文数量: 287
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 2130
  • 用 户 组: 普通用户
  • 注册时间: 2014-03-31 14:30
个人简介

自己慢慢积累。

文章分类

(287)

  • (1)
  • (1)
  • (1)
  • (3)
  • (21)
  • (1)
  • (3)
  • (64)
  • (19)
  • (1)
  • (5)
  • (7)
  • (3)
  • (4)
  • (10)
  • (2)
  • (10)
  • (2)
  • (71)
  • (58)
  • (0)
相关博文
  • ·
  • ·
  • ·
  • ·
  • ·
  • ·
  • ·
  • ·
  • ·
  • ·

分类: mysql/postgresql

2022-09-27 10:22:05

1. 下载5.7的安装包

  1. wget https://dev.mysql.com/get/mysql-5.7.39-el7-x86_64.tar.gz
想要其他版本,可以在官方网站下载:
https://dev.mysql.com/downloads/mysql/

2. 解压安装
tar -zxvf mysql-5.7.39-el7-x86_64.tar.gz
改个名看着方便,不改也行
mv mysql-5.7.39-el7-x86_64  mysql

进入mysql文件夹,创建一个必要的文件夹
cd mysql
mkdir log tmp var data conf

conf里面创建cnf文件
vim conf/my.cnf
里面的路径需要自己改下

点击(此处)折叠或打开

  1. [mysqld]
  2. user = uplus
  3. port = 3306
  4. key_buffer_size = 256m
  5. max_allowed_packet = 256m
  6. slave_max_allowed_packet = 256m
  7. table_open_cache = 512
  8. sort_buffer_size = 2m
  9. net_buffer_length = 8k
  10. read_buffer_size = 2m
  11. read_rnd_buffer_size = 512k
  12. myisam_sort_buffer_size = 64m
  13. thread_cache_size = 64
  14. query_cache_size = 64m
  15. max_connections = 32000
  16. tmp_table_size = 128m
  17. long_query_time = 3
  18. slow_query_log
  19. innodb_buffer_pool_size = 7000m
  20. innodb_flush_log_at_trx_commit = 0
  21. innodb_flush_method = o_direct
  22. innodb_file_format = barracuda
  23. innodb_log_file_size = 1g
  24. innodb_log_files_in_group = 3
  25. character_set_server = utf8
  26. log_timestamps = system
  27. #have_statement_timeout = no
  28. ############### path ##############
  29. basedir = /home/uplus/package/mysql
  30. datadir = /home/uplus/package/mysql/data
  31. tmpdir = /home/uplus/package/mysql/tmp
  32. socket = /home/uplus/package/mysql/var/mysql.sock
  33. pid_file = /home/uplus/package/mysql/var/mysql.pid
  34. general_log_file = /home/uplus/package/mysql/log/general.log
  35. innodb_data_home_dir = /home/uplus/package/mysql/data
  36. slow_query_log_file = /home/uplus/package/mysql/log/slow.log
  37. log_error = /home/uplus/package/mysql/log/error.log
  38. sql_mode=no_engine_substitution,strict_trans_tables
  39. [mysql]
  40. default-character-set = utf8

进入mysql/bin 目录,进行安装
./mysqld --initialize --basedir=/home/uplus/package/mysql/ --datadir=/home/uplus/package/mysql/data --user=uplus  --socket=/home/uplus/package/mysql/var --port=3306

如果安装报错:
./mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: no such file or directory。
需要安装两个包:
yum install -y libaio.so.1
yum install -y libaio

初始化完成后,{banned}最佳后一行会显示root密码,一定要保存下来。



启动mysql
需要根据实际修改路径
  1. nohup bin/mysqld_safe --defaults-file=/home/uplus/package/mysql/conf/my.cnf --socket=/home/uplus/package/mysql/var/mysql.sock &
启动后,必须要对mysql的root密码就行修改
先登录mysql
bin/mysql -u root -s/home/uplus/package/mysql/var/mysql.sock -p
输入初始的密码
set password=password('123456');

配置远程登陆权限
grant all privileges on *.* to root@'%' identified by '123456';
flush privileges;

查看是否成功
use mysql;
select host,user from user;

退出myql

配置环境变量和开机启动
ln -s /home/hadoop/mysql/var/mysql.sock /tmp/mysql.sock

设置环境变量
export mysql_home=/home/uplus/package/mysql
export path=$mysql_home/bin:$path

如果有root权限 可以设置开机启动
cp support-files/mysql.server /etc/init.d/mysql



停止mysql服务的方法:

mysqladmin -uroot -p shutdown -s /home/uplus/package/var/mysql.sock







阅读(6066) | 评论(0) | 转发(1) |
0

上一篇:

下一篇:

给主人留下些什么吧!~~
")); function link(t){ var href= $(t).attr('href'); href ="?url=" encodeuricomponent(location.href); $(t).attr('href',href); //setcookie("returnouturl", location.href, 60, "/"); }
网站地图