linuxインストールmysql詳細手順
linuxシステムバージョン:CentOS 7.4 64ビット
インストール元ファイルバージョン:mysql-8.0.11-linux-glibc 2.12-x86_64.tar.gz
mysqlインストール場所:/software/mysql
データベースファイルデータの場所:/data/mysql
注意:混同は防止されていません.ここでは絶対パスでコマンドを実行します.
ファイルの内容の#を除いて、ここのすべての#はlinuxコマンドです.
>mysqlはmysqlのコマンドです
手順:
1、ルートディレクトリの下にフォルダソフトウェアとデータベースデータファイル/data/mysqlを作成する
#mkdir/software/
#mkdir/data/mysql
2、mysql-8.0.11-linux-glibc 2をアップロードする.12-x86_64.tar.gzファイルを/softwareの下に
#cd/software/
#tar -zxvf mysql-8.0.11-linux-glibc2.12-x86_64.tar.gz
3、解凍後のフォルダ名の変更
#mv/software/mysql-8.0.11-linux-glibc2.12-x86_64.tar.gz/ /software/mysql
4、mysqlユーザーグループとmysqlユーザーの作成
#groupadd mysql
#useradd mysql -g mysql
5、myqlユーザーをmysqlユーザーグループに関連付ける
#chown -R mysql:mysql /software/mysql/
6、mysqlインストールフォルダmysql/の権限を変更する
#chmod -R 755/software/mysql/
7、libaio依存パッケージをインストールします.私が買ったテンセントクラウドサーバーcentosシステムが持っているこの依存パッケージがあるのでインストールする必要はありませんが、持っている依存パッケージは間違っています.後で解決方法を紹介します.
libaio依存パッケージを暗転するかどうかを問い合わせる
#yum search libaio
インストールされていない場合は、次のコマンドでインストールできます.
#yum install libaio
8、mysqlコマンドの初期化
#./software/mysql/bin/mysqld --user=mysql --basedir=/software/mysql --datadir=/data/mysql --initialize
上記のコマンドを実行するときは、特に1行の内容に注意してください.
A temporary password is generated for root@localhost: wIs._&7%1GvI
root@localhost: mysql ,
:
error while loading shared libraries: libnuma.so.1: cannot open shared objec
libnuma 32 , 64 ,
#yum install numactl.x86_64
mysql , 8 ;
9、 Mysql
#cp /software/mysql/support-files/mysql.server /etc/init.d/mysqld
#chmod 755 /etc/init.d/mysqld
#vi /etc/init.d/mysqld
63-73
# Set some defaults
mysqld_pid_file_path=
if test -z "$basedir
then
basedir=/usr/local/mysql
bindir=/usr/local/mysql/bin
if test -z "$datadir"
then
datadir=/usr/local/mysql/data
fi
sbindir=/usr/local/mysql/bin
libexecdir=/usr/local/mysql/bin
else
bindir="$basedir/bin"
if test -z "$datadir"
then
datadir="$basedir/data"
fi
sbindir="$basedir/sbin"
libexecdir="$basedir/libexec"
fi
:
# Set some defaults
mysqld_pid_file_path=
if test -z "$basedir"
then
basedir=/software/mysql
bindir=/software/mysql/bin
if test -z "$datadir"
then
datadir=/data/mysql
fi
sbindir=/software/mysql/bin
libexecdir=/software/mysql/bin
else
bindir="$basedir/bin"
if test -z "$datadir"
then
datadir="$basedir/data"
fi
sbindir="$basedir/sbin"
libexecdir="$basedir/libexec"
fi
:wq
10、 my.cnf
#vi /etc/my.cnf
my.cnf
[client]
no-beep
socket =/software/mysql/mysql.sock
# pipe
# socket=0.0
port=3306
[mysql]
default-character-set=utf8
[mysqld]
basedir=/software/mysql
datadir=/data/mysql
port=3306
pid-file=/software/mysql/mysqld.pid
#skip-grant-tables
skip-name-resolve
socket = /software/mysql/mysql.sock
character-set-server=utf8
default-storage-engine=INNODB
explicit_defaults_for_timestamp = true
# Server Id.
server-id=1
max_connections=2000
#query_cache_size=0
table_open_cache=2000
tmp_table_size=246M
thread_cache_size=300
# 。
thread_stack = 192k
key_buffer_size=512M
read_buffer_size=4M
read_rnd_buffer_size=32M
innodb_data_home_dir = /data/mysql
innodb_flush_log_at_trx_commit=0
innodb_log_buffer_size=16M
innodb_buffer_pool_size=256M
innodb_log_file_size=128M
innodb_thread_concurrency=128
innodb_autoextend_increment=1000
innodb_buffer_pool_instances=8
innodb_concurrency_tickets=5000
innodb_old_blocks_time=1000
innodb_open_files=300
innodb_stats_on_metadata=0
innodb_file_per_table=1
innodb_checksum_algorithm=0
back_log=80
flush_time=0
join_buffer_size=128M
max_allowed_packet=1024M
max_connect_errors=2000
open_files_limit=4161
#query_cache_type=0
sort_buffer_size=32M
table_definition_cache=1400
binlog_row_event_max_size=8K
sync_master_info=10000
sync_relay_log=10000
sync_relay_log_info=10000
# , , 8M
bulk_insert_buffer_size = 64M
interactive_timeout = 120
wait_timeout = 120
log-bin-trust-function-creators=1
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
#
# include all files from the config directory
#
!includedir /etc/my.cnf.d
:wq
11、 mysql
#./software/mysql/support-files/mysql.server start
12、 , , /data/mysql
rm -rf /data/mysql
8 ;
13、 mysql
#/etc/init.d/mysqld start
14、 mysql
#/software/mysql/bin/mysql -u root –p
15、 bash: mysql: command not found : /usr/bin , , , /usr/bin , 。https://www.jb51.net/article/34622.htm
# cd /usr/local/bin
# ln -fs /software/mysql/bin/mysql mysql
16、 。 8 root@localhost:
17、 , :
You must reset your password using ALTER USER statement before executing this statement.
https://blog.csdn.net/hj7jay/article/details/65626766
: alter user user() identified by "123456";
18、Mysql Navicate :
(1)1130-host . is not allowed to connect to this MySql server,MySQL
, localhost。 localhost , mysql , "mysql" "user" "host" , "localhost" "%"
mysql -u root -p
mysql>use mysql;
mysql>update user set host = '%' where user = 'root';
mysql>select host, user from user;
https://blog.csdn.net/zyj405569395/article/details/53614356
(2)2059 - authentication plugin 'caching_sha2_password' -navicat
:
mysql8 , 2059 , caching_sha2_password, mysql5.7 mysql_native_password ,navicate
mysql5.7
ALTER USER 'root'@'%' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER; #
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'password'; #
FLUSH PRIVILEGES; #
https://blog.csdn.net/kiddyt05/article/details/80074752
https://blog.csdn.net/m0_38017782/article/details/80061991
:https://blog.csdn.net/a774630093/article/details/79270080