mysql8.0.17绿色安装centos7

database

[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

[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

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)

以上是 mysql8.0.17绿色安装centos7 的全部内容, 来源链接: utcz.com/z/531519.html

回到顶部