日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

centos7离线安装mysql_Red Hat6.4离线安装mysql安装手册

發布時間:2025/3/20 数据库 23 豆豆
生活随笔 收集整理的這篇文章主要介紹了 centos7离线安装mysql_Red Hat6.4离线安装mysql安装手册 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

注(/home/mysql/data/mysql/data)目錄結構

[root@localhost ]# cd /home

[[root@localhost home]# useradd mysql

(新建目錄data)

[[root@localhost home]#cd /data

[[root@localhost data]# echo 'mysql'|passwd --stdin mysql

更改用戶 mysql 的密碼 。

passwd: 所有的身份驗證令牌已經成功更新。

上傳包mysql-5.6.42-linux-glibc2.12-x86_64.tar.gz(目錄/home/mysql/data/)

[root@Master data]# tar -zxvf mysql-5.6.42-linux-glibc2.12-x86_64.tar.gz

mysql-5.6.42-linux-glibc2.12-x86_64/share/charsets/macce.xml

mysql-5.6.42-linux-glibc2.12-x86_64/share/charsets/Index.xml

mysql-5.6.42-linux-glibc2.12-x86_64/share/russian/errmsg.sys

mysql-5.6.42-linux-glibc2.12-x86_64/share/estonian/errmsg.sys

mysql-5.6.42-linux-glibc2.12-x86_64/share/hungarian/errmsg.sys

mysql-5.6.42-linux-glibc2.12-x86_64/share/polish/errmsg.sys

mysql-5.6.42-linux-glibc2.12-x86_64/share/romanian/errmsg.sys

mysql-5.6.42-linux-glibc2.12-x86_64/share/spanish/errmsg.sys

[root@localhost data]# ls

mysql-5.6.42-linux-glibc2.12-x86_64 mysql-5.6.42-linux-glibc2.12-x86_64.tar.gz

[root@localhost data]# mv mysql-5.6.42-linux-glibc2.12-x86_64 mysql

[root@localhost data]# ls

mysql mysql-5.6.42-linux-glibc2.12-x86_64.tar.gz

[root@localhost data]# chown -R mysql:mysql mysql

[root@localhost data]# su mysql

[mysql@localhost data]$ cd mysql/scripts/

[mysql@localhost scripts]$ ls

mysql_install_db

[mysql@localhost scripts]$ ./mysql_install_db --user=mysql --basedir=/home/mysql/data/mysql --datadir=/home/mysql/data/mysql/data

Installing MySQL system tables...2018-11-28 11:42:58 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

.

.

.

2018-11-28 11:42:59 2933 [Note] InnoDB: Starting shutdown...

2018-11-28 11:43:00 2933 [Note] InnoDB: Shutdown completed; log sequence number 1625977

OK

Filling help tables...2018-11-28 11:43:00 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

2018-11-28 11:43:00 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.

2018-11-28 11:43:00 0 [Note] /home/mysql/data/mysql/bin/mysqld (mysqld 5.6.42) starting as process 2955 ...

2018-11-28 11:43:00 2955 [Warning] Buffered warning: Changed limits: max_open_files: 1024 (requested 5000)

2018-11-28 11:43:00 2955 [Warning] Buffered warning: Changed limits: table_open_cache: 431 (requested 2000)

2018-11-28 11:43:02 2955 [Note] InnoDB: Shutdown completed; log sequence number 1625987

OK

To start mysqld at boot time you have to copy

support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !

To do so, start the server, then issue the following commands:

/home/mysql/data/mysql/bin/mysqladmin -u root password 'new-password'

/home/mysql/data/mysql/bin/mysqladmin -u root -h localhost.localdomain password 'new-password'

Alternatively you can run:

/home/mysql/data/mysql/bin/mysql_secure_installation

which will also give you the option of removing the test

databases and anonymous user created by default. This is

strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:

cd . ; /home/mysql/data/mysql/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl

cd mysql-test ; perl mysql-test-run.pl

Please report any problems at http://bugs.mysql.com/

The latest information about MySQL is available on the web at

http://www.mysql.com

Support MySQL by buying support/licenses at http://shop.mysql.com

New default config file was created as /home/mysql/data/mysql/my.cnf and

will be used by default by the server when you start it.

You may edit this file to change server settings

WARNING: Default config file /etc/my.cnf exists on the system

This file will be read by default by the MySQL server

If you do not want to use this, either remove it, or use the

--defaults-file argument to mysqld_safe when starting the server

[mysql@localhost scripts]$ cd ../support-files/

[mysql@localhost support-files]$ cp my-default.cnf /etc/my.cnf

cp: cannot create regular file `/etc/my.cnf': Permission denied(提示沒權限)

[mysql@localhost support-files]$ ls

binary-configure magic my-default.cnf mysqld_multi.server mysql-log-rotate mysql.server

[mysql@localhost support-files]$ chmod 777 *

[mysql@localhost support-files]$ ls

binary-configure magic my-default.cnf mysqld_multi.server mysql-log-rotate mysql.server

[mysql@localhost support-files]$ cp my-default.cnf /etc/my.cnf

cp: cannot create regular file `/etc/my.cnf': Permission denied

[mysql@localhost support-files]$ su

Password:

[root@localhost support-files]# cp my-default.cnf /etc/my.cnf

cp: overwrite `/etc/my.cnf'? y

[root@localhost support-files]# ls

binary-configure magic my-default.cnf mysqld_multi.server mysql-log-rotate mysql.server

[root@localhost support-files]# cp mysql.server /etc/init.d/mysql

[root@localhost support-files]# vim /etc/init.d/mysql

[root@localhost support-files]# vim /etc/profile

[root@localhost ~]# cd /usr/local/bin

[root@localhost bin]# chkconfig --add mysql

[root@localhost bin]# chkconfig mysql on

[root@localhost ~]# cd /home/mysql/data/mysql

[root@localhost mysql]# ls

bin COPYING data docs include lib man my.cnf mysql-test README scripts share sql-bench support-files

[root@localhost mysql]# cd support-files/

[root@localhost support-files]# ls

binary-configure magic my-default.cnf mysqld_multi.server mysql-log-rotate mysql.server

[root@localhost support-files]# service mysql start

Starting MySQL.Logging to '/home/mysql/data/mysql/data/localhost.localdomain.err'.

SUCCESS!

[root@localhost support-files]# chmod a+wrx /etc/init.d/mysql

[root@localhost support-files]# service mysql start

Starting MySQL SUCCESS!

[root@localhost ~]# cd /home/mysql/data/mysql/bin/

[root@localhost bin]# ./mysqladmin -u root password 'root'

Warning: Using a password on the command line interface can be insecure.

[root@localhost bin]# ./mysql -uroot -p

Enter password: root

Welcome to the MySQL monitor. Commands end with ; or g.

Your MySQL connection id is 4

Server version: 5.6.42 MySQL Community Server (GPL)

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

mysql> use mysql

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with -A

Database changed

mysql> select host,user from user;

+-----------------------+------+

| host | user |

+-----------------------+------+

| 127.0.0.1 | root |

| ::1 | root |

| localhost | |

| localhost | root |

| localhost.localdomain | |

| localhost.localdomain | root |

+-----------------------+------+

6 rows in set (0.00 sec)

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;

Query OK, 0 rows affected (0.00 sec)

mysql> FLUSH PRIVILEGES;

Query OK, 0 rows affected (0.01 sec)

mysql> select host,user from user;

+-----------------------+------+

| host | user |

+-----------------------+------+

| % | root |

| 127.0.0.1 | root |

| ::1 | root |

| localhost | |

| localhost | root |

| localhost.localdomain | |

| localhost.localdomain | root |

+-----------------------+------+

7 rows in set (0.00 sec)

mysql> exit

Bye

[root@localhost bin]# cd

[root@localhost ~]# vim /etc/init.d/mysql

[1]+ Stopped vim /etc/init.d/mysql

[root@localhost ~]# vi /etc/my.cnf

# For advice on how to change settings please see

# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html

# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the

# *** default location during install, and will be replaced if you

# *** upgrade to a newer version of MySQL.

[client]

default-character-set=utf8

[mysqld]

lower_case_table_names=1

character-set-server=utf8

collation-server=utf8_general_ci

# 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 leading # to turn on a very important data integrity option: logging

# changes to the binary log between backups.

# log_bin

# These are commonly set, remove the # and set as required.

# basedir = .....

# datadir = .....

# port = .....

# server_id = .....

# socket = .....

# 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

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

~

"/etc/my.cnf" 32L, 1151C

參考

# For advice on how to change settings please see

# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html

# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the

# *** default location during install, and will be replaced if you

# *** upgrade to a newer version of MySQL.

[client]

default-character-set=utf8

[mysqld]

lower_case_table_names=1

character-set-server=utf8

collation-server=utf8_general_ci

# 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 leading # to turn on a very important data integrity option: logging

# changes to the binary log between backups.

# log_bin

# These are commonly set, remove the # and set as required.

# basedir = .....

# datadir = .....

# port = .....

# server_id = .....

# socket = .....

# 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

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

總結

以上是生活随笔為你收集整理的centos7离线安装mysql_Red Hat6.4离线安装mysql安装手册的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。