mysql-8.0.17绿色安装-centos7「建议收藏」

mysql-8.0.17绿色安装-centos7「建议收藏」[root@08fc27e1d3e3 local]# yum install libaio numactl ncurses-compat-libs [root@08fc27e1d3e3 local]…

[root@08fc27e1d3e3 local]# yum install libaio numactl ncurses-compat-libs
[root@08fc27e1d3e3 local]# wget http://mirrors.ustc.edu.cn/mysql-ftp/Downloads/MySQL-8.0/mysql-8.0.17-linux-glibc2.12-x86_64.tar.xz
[root@08fc27e1d3e3 local]# xz -d mysql-8.0.17-linux-glibc2.12-x86_64.tar.xz 
[root@08fc27e1d3e3 local]# mv mysql-8.0.17-linux-glibc2.12-x86_64.tar /usr/local/
[root@08fc27e1d3e3 local]# tar -xvf mysql-8.0.17-linux-glibc2.12-x86_64.tar
[root@08fc27e1d3e3 local]# mv mysql-8.0.17-linux-glibc2.12-x86_64/ mysql-8.0.17
[root@08fc27e1d3e3 local]# cd mysql-8.0.17
[root@08fc27e1d3e3 mysql-8.0.17]# vim my.cnf
[mysqld]
user=mysql
character-set-server=utf8mb4
socket=/usr/local/mysql-8.0.17/mysql.sock
datadir=/usr/local/mysql-8.0.17/dat
log-error=/usr/local/mysql-8.0.17/mysqld.log
slow_query_log_file=/usr/local/mysql-8.0.17/slow-query.log
default-storage-engine=InnoDB
explicit_defaults_for_timestamp=true
max_connections=256
slow_query_log=on
long_query_time=2
log_queries_not_using_indexes=off
read_buffer_size=4M
max_allowed_packet=64M
join_buffer_size=128M
sort_buffer_size=2M
read_rnd_buffer_size=2M
innodb_flush_log_at_trx_commit=0
innodb_buffer_pool_size=256M
innodb_buffer_pool_instances=8
bulk_insert_buffer_size=64M
performance_schema=OFF
performance_schema_max_table_instances=64
init_connect="SET NAMES utf8mb4"
#
[client]
default-character-set=utf8mb4

代码100分

代码100分[root@08fc27e1d3e3 mysql-8.0.17]# mkdir dat
[root@08fc27e1d3e3 mysql-8.0.17]# groupadd mysql
[root@08fc27e1d3e3 mysql-8.0.17]# useradd -r -g mysql mysql
[root@08fc27e1d3e3 mysql-8.0.17]# chown -R mysql .
[root@08fc27e1d3e3 mysql-8.0.17]# chgrp -R mysql .
[root@08fc27e1d3e3 mysql-8.0.17]# vim mysqld.log                #创建一个空的mysqld.log
[root@08fc27e1d3e3 mysql-8.0.17]# ls -lht
total 480K
drwxr-xr-x  2 mysql mysql 4.0K Sep 28 07:43 dat
drwxr-xr-x  4 mysql mysql 4.0K Jun 26 22:35 man
drwxrwxr-x  2 mysql mysql 4.0K Jun 26 22:35 run
drwxr-xr-x  3 mysql mysql 4.0K Jun 26 22:35 var
drwxr-xr-x  2 mysql mysql 4.0K Jun 26 22:35 bin
drwxr-xr-x  2 mysql mysql 4.0K Jun 26 22:35 docs
drwxr-xr-x  3 mysql mysql 4.0K Jun 26 22:35 include
drwxr-xr-x  6 mysql mysql 4.0K Jun 26 22:35 lib
drwxr-xr-x 28 mysql mysql 4.0K Jun 26 22:35 share
drwxr-xr-x  2 mysql mysql 4.0K Jun 26 22:35 support-files
-rw-r--r--  1 mysql mysql 330K Jun 25 10:23 LICENSE
-rw-r--r--  1 mysql mysql 100K Jun 25 10:23 LICENSE.router
-rw-r--r--  1 mysql mysql  687 Jun 25 10:23 README
-rw-r--r--  1 mysql mysql  700 Jun 25 10:23 README.router
-rw-r--r--  1 mysql mysql    0 Jun 25 10:23 mysqld.log

[root@7bdc6644c7c4 mysql-8.0.17]# ./bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql-8.0.17 --datadir=/usr/local/mysql-8.0.17/dat
2019-09-28T07:48:21.224959Z 0 [System] [MY-013169] [Server] /usr/local/mysql-8.0.17/bin/mysqld (mysqld 8.0.17) initializing of server in progress as process 25931
2019-09-28T07:48:26.899840Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: )t4I7RE8w>yU                    #记住这个密码.
2019-09-28T07:48:28.575259Z 0 [System] [MY-013170] [Server] /usr/local/mysql-8.0.17/bin/mysqld (mysqld 8.0.17) initializing of server has completed
[root@08fc27e1d3e3 mysql-8.0.17]# cp support-files/mysql.server /etc/init.d/
[root@08fc27e1d3e3 mysql-8.0.17]# vim /etc/init.d/mysql.server
  • 要修改的部分
 40 # If you want to affect other MySQL variables, you should make your changes
 41 # in the /etc/my.cnf, ~/.my.cnf or other MySQL configuration files.
 42 
 43 # If you change base dir, you must also change datadir. These may get
 44 # overwritten by settings in the MySQL configuration files.
 45 
 46 basedir=/usr/local/mysql-8.0.17                         //----
 47 datadir=/usr/local/mysql-8.0.17/dat                     //----
 48 
 49 # Default value, in seconds, afterwhich the script should timeout waiting
 50 # for server start. 
 51 # Value here is overriden by value in my.cnf. 
 52 # 0 means don"t wait at all
 53 # Negative numbers mean to wait indefinitely
代码100分201 # Get arguments from the my.cnf file,
202 # the only group, which is read from now on is [mysqld]
203 if test -x "$bindir/my_print_defaults";  then
204   print_defaults="$bindir/my_print_defaults"
205 else
206   # Try to find basedir in /etc/my.cnf
207   conf=/usr/local/mysql-8.0.17/my.cnf                   //---
208   print_defaults=
209   if test -r $conf
210   then
[root@08fc27e1d3e3 mysql-8.0.17]# service mysql.server restart
 ERROR! MySQL server PID file could not be found!
Starting MySQL.. SUCCESS! 
[root@08fc27e1d3e3 mysql-8.0.17]# mysql -uroot -p -S ./mysql.sock
Enter password: 

修改root密码:

mysql> alter user user() identified by "dev5";
mysql> create user "root"@"%" identified by "dev5";
Query OK, 0 rows affected (0.02 sec)
mysql> grant all privileges on *.* to root@"%";
Query OK, 0 rows affected (0.02 sec)
mysql> flush privileges; 
Query OK, 0 rows affected (0.04 sec)

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
转载请注明出处: https://daima100.com/10799.html

(0)
上一篇 2022-12-21 17:30
下一篇 2022-12-21

相关推荐

  • 优化代码效率:Python的双向队列实现

    优化代码效率:Python的双向队列实现双向队列(deque)是一种具有队列和栈性质的数据结构。它支持从队列的两端添加和删除元素。它非常适合需要对队列头和尾进行操作的场景,如滑动窗口算法和BFS算法。

    2023-12-24
    91
  • MySQL 约束「终于解决」

    MySQL 约束「终于解决」* 概念: 对表中的数据进行限定,保证数据的正确性、有效性和完整性。 * 分类: 1. 主键约束:primary key 2. 非空约束:not null 3. 唯一约束:unique 4. 外键约束

    2023-03-23
    134
  • cdh安装flink_hadoop为什么要编译源码

    cdh安装flink_hadoop为什么要编译源码准备工作 因为在编译时需要下载许多依赖包,在执行编译前最好先配置下代理仓库 编译flink shaded 因为flink依赖flink shaded工程,基本的依赖项都是在这个工程里面定义的,所以要先

    2023-01-23
    137
  • Python中dropna的用法

    Python中dropna的用法在数据分析和处理过程中,经常会遇到数据缺失的情况,这时候就需要使用dropna方法来删除缺失值。

    2024-04-27
    45
  • Python实现列表添加元素的方法

    Python实现列表添加元素的方法Python的列表是可变的序列,在使用时可以通过以下方法添加元素:

    2024-02-25
    82
  • 解决Access文件越来越大的问题[通俗易懂]

    解决Access文件越来越大的问题[通俗易懂]有时候在使用Access文件的时候,随着增删改的不断的连续,会导致文件越来越大。即使手动删除或者使用delete语句删除了大量的数据记录,会发现文件的大小依然没有减掉,而且随着你再往里写数据,又会增…

    2023-03-31
    141
  • Python中单引号和双引号的区别

    Python中单引号和双引号的区别Python是一种非常流行的编程语言,它简单易学,容易上手。在Python中,我们经常需要使用引号来包含字符串,但在这种情况下,Python支持两种不同类型的引号:单引号和双引号。这两种引号可以互换使用,但使用它们的方式有微小的差别。本文将介绍使用单引号和双引号的区别和如何选择正确的引号。

    2024-04-25
    43
  • Django配置MySQL数据库教程

    Django配置MySQL数据库教程
    简介 在实际生产环境,Django是不可能使用SQLite这种轻量级的基于文件的数据库作为生产数据库。一般较多的会选择MySQL。如果使用SQLite这种轻…

    2023-04-05
    137

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注