CentOS安装使用二进制方式mysql5.6笔记
发表于:2025-01-20 作者:千家信息网编辑
千家信息网最后更新 2025年01月20日,CentOS安装使用二进制方式mysql5.6笔记1、上传安装包--使用root用户2、解压安装包--使用root用户cd /usr/local/tar xzvf mysql-5.6.23-linux
千家信息网最后更新 2025年01月20日CentOS安装使用二进制方式mysql5.6笔记
2、解压安装包--使用root用户
cd /usr/local/
tar xzvf mysql-5.6.23-linux-glibc2.5-x86_64.tar.gz
mv mysql-5.6.23-linux-glibc2.5-x86_64 mysql
3、创建mysql管理用户组与用户--使用root用户
groupadd -g 101 dba
useradd -u 514 -g dba -G root -d /usr/local/mysql mysqladmin
验证:id mysqladmin
4、修改mysqladmin用户密码--使用root用户
passwd mysqladmin
提示:
Changing password for user mysqladmin.
New UNIX password:
BAD PASSWORD: it is too simplistic/systematic
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
5、copy 环境变量配置文件至mysqladmin用户的home目录中,为了以下步骤配置个人环境变量--使用root用户
cp /etc/skel/.* /usr/local/mysql
提示:
cp: omitting directory `/etc/skel/.'
cp: omitting directory `/etc/skel/..'
cp: omitting directory `/etc/skel/.mozilla'
6、修改/etc/my.cnf文件,并删除原文件内容,将以下内容填写到my.cnf文件中--使用root用户
vi /etc/my.cnf
[client]
port = 3306
socket = /usr/local/mysql/data/mysql.sock
[mysqld]
port = 3306
socket = /usr/local/mysql/data/mysql.sock
skip-external-locking
key_buffer_size = 256M
sort_buffer_size = 2M
read_buffer_size = 2M
read_rnd_buffer_size = 4M
query_cache_size= 32M
max_allowed_packet = 16M
myisam_sort_buffer_size=128M
tmp_table_size=32M
table_open_cache = 512
thread_cache_size = 8
wait_timeout = 86400
interactive_timeout = 86400
max_connections = 600
# Try number of CPU's*2 for thread_concurrency
thread_concurrency = 32
#isolation level and default engine
default-storage-engine = INNODB
transaction-isolation = READ-COMMITTED
server-id = 1
basedir = /usr/local/mysql
datadir = /usr/local/mysql/data
pid-file = /usr/local/mysql/data/hostname.pid
#open performance schema
log-warnings
sysdate-is-now
binlog_format = MIXED
log_bin_trust_function_creators=1
log-error = /usr/local/mysql/data/hostname.err
log-bin=/usr/local/mysql/arch/mysql-bin
#other logs
#general_log =1
#general_log_file = /usr/local/mysql/data/general_log.err
#slow_query_log=1
#slow_query_log_file=/usr/local/mysql/data/slow_log.err
#for replication slave
#log-slave-updates
#sync_binlog = 1
#for innodb options
innodb_data_home_dir = /usr/local/mysql/data/
innodb_data_file_path = ibdata1:500M:autoextend
innodb_log_group_home_dir = /usr/local/mysql/arch
innodb_log_files_in_group = 2
innodb_log_file_size = 200M
innodb_buffer_pool_size = 2048M
innodb_additional_mem_pool_size = 50M
innodb_log_buffer_size = 16M
innodb_lock_wait_timeout = 100
#innodb_thread_concurrency = 0
innodb_flush_log_at_trx_commit = 1
innodb_locks_unsafe_for_binlog=1
#innodb io features: add for mysql5.5.8
performance_schema
innodb_read_io_threads=4
innodb-write-io-threads=4
innodb-io-capacity=200
#purge threads change default(0) to 1 for purge
innodb_purge_threads=1
innodb_use_native_aio=on
#case-sensitive file names and separate tablespace
innodb_file_per_table = 1
lower_case_table_names=1
[mysqldump]
quick
max_allowed_packet = 16M
[mysql]
no-auto-rehash
[mysqlhotcopy]
interactive-timeout
[myisamchk]
key_buffer_size = 256M
sort_buffer_size = 256M
read_buffer = 2M
write_buffer = 2M
7、修改/etc/my.cnf文件用户组与用户、权限--使用root用户
cd /usr/local
chown mysqladmin:dba /etc/my.cnf
chmod 640 /etc/my.cnf
验证:
ll my.cnf
-rw-r----- 1 mysqladmin dba 2201 Dec 19 11:19:40 my.cnf
8、修改mysql安装文件用户组与用户、权限--使用root用户
chown -R mysqladmin:dba /usr/local/mysql
chmod -R 755 /usr/local/mysql
su - mysqladmin
pwd显示:/usr/local/mysql
9、创建arch目录--使用mysqladmin用户
cd /usr/local/mysql
mkdir arch
10、检查gcc、libaio、perl以及perl-devel包是否安装
rpm -qa|grep gcc libaio perl perl-devel
如未安装,则使用yum方式安装:yum -y install libaio、yum -y install gcc、yum -y install perl
11、二进制安装
scripts/mysql_install_db --user=mysqladmin --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
提示:
Installing MySQL system tables...2017-12-19 11:39:15 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
OK
Filling help tables...2017-12-19 11:39:15 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
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:
./bin/mysqladmin -u root password 'new-password'
./bin/mysqladmin -u root -h sht-sgmhadoopnn-01 password 'new-password'
Alternatively you can run:
./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 . ; ./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 ./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
12、启动mysql--使用mysqladmin用户
su - mysqladmin
cd /usr/local/mysql
rm -rf my.cnf
bin/mysqld_safe &
验证是否启动:ps -ef|grep mysqld、netstat -tulnp | grep mysql
13、登录mysql,并修改mysql中的root密码内容--使用mysqladmin用户
mysql
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
注:如mysql数据库名称,则退出(exit)使用:mysql -uroot -p,提示输入密码时直接回车
mysql> use mysql
mysql> update user set password=password('123456') where user='root';
mysql> select host,user,password from user;
mysql> delete from user where user='';
mysql> select host,user,password from user;
mysql> flush privileges;
若泽大数据交流群:671914634
CentOS安装使用二进制方式mysql5.6笔记
1、上传安装包--使用root用户2、解压安装包--使用root用户
cd /usr/local/
tar xzvf mysql-5.6.23-linux-glibc2.5-x86_64.tar.gz
mv mysql-5.6.23-linux-glibc2.5-x86_64 mysql
3、创建mysql管理用户组与用户--使用root用户
groupadd -g 101 dba
useradd -u 514 -g dba -G root -d /usr/local/mysql mysqladmin
验证:id mysqladmin
4、修改mysqladmin用户密码--使用root用户
passwd mysqladmin
提示:
Changing password for user mysqladmin.
New UNIX password:
BAD PASSWORD: it is too simplistic/systematic
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
5、copy 环境变量配置文件至mysqladmin用户的home目录中,为了以下步骤配置个人环境变量--使用root用户
cp /etc/skel/.* /usr/local/mysql
提示:
cp: omitting directory `/etc/skel/.'
cp: omitting directory `/etc/skel/..'
cp: omitting directory `/etc/skel/.mozilla'
6、修改/etc/my.cnf文件,并删除原文件内容,将以下内容填写到my.cnf文件中--使用root用户
vi /etc/my.cnf
[client]
port = 3306
socket = /usr/local/mysql/data/mysql.sock
[mysqld]
port = 3306
socket = /usr/local/mysql/data/mysql.sock
skip-external-locking
key_buffer_size = 256M
sort_buffer_size = 2M
read_buffer_size = 2M
read_rnd_buffer_size = 4M
query_cache_size= 32M
max_allowed_packet = 16M
myisam_sort_buffer_size=128M
tmp_table_size=32M
table_open_cache = 512
thread_cache_size = 8
wait_timeout = 86400
interactive_timeout = 86400
max_connections = 600
# Try number of CPU's*2 for thread_concurrency
thread_concurrency = 32
#isolation level and default engine
default-storage-engine = INNODB
transaction-isolation = READ-COMMITTED
server-id = 1
basedir = /usr/local/mysql
datadir = /usr/local/mysql/data
pid-file = /usr/local/mysql/data/hostname.pid
#open performance schema
log-warnings
sysdate-is-now
binlog_format = MIXED
log_bin_trust_function_creators=1
log-error = /usr/local/mysql/data/hostname.err
log-bin=/usr/local/mysql/arch/mysql-bin
#other logs
#general_log =1
#general_log_file = /usr/local/mysql/data/general_log.err
#slow_query_log=1
#slow_query_log_file=/usr/local/mysql/data/slow_log.err
#for replication slave
#log-slave-updates
#sync_binlog = 1
#for innodb options
innodb_data_home_dir = /usr/local/mysql/data/
innodb_data_file_path = ibdata1:500M:autoextend
innodb_log_group_home_dir = /usr/local/mysql/arch
innodb_log_files_in_group = 2
innodb_log_file_size = 200M
innodb_buffer_pool_size = 2048M
innodb_additional_mem_pool_size = 50M
innodb_log_buffer_size = 16M
innodb_lock_wait_timeout = 100
#innodb_thread_concurrency = 0
innodb_flush_log_at_trx_commit = 1
innodb_locks_unsafe_for_binlog=1
#innodb io features: add for mysql5.5.8
performance_schema
innodb_read_io_threads=4
innodb-write-io-threads=4
innodb-io-capacity=200
#purge threads change default(0) to 1 for purge
innodb_purge_threads=1
innodb_use_native_aio=on
#case-sensitive file names and separate tablespace
innodb_file_per_table = 1
lower_case_table_names=1
[mysqldump]
quick
max_allowed_packet = 16M
[mysql]
no-auto-rehash
[mysqlhotcopy]
interactive-timeout
[myisamchk]
key_buffer_size = 256M
sort_buffer_size = 256M
read_buffer = 2M
write_buffer = 2M
7、修改/etc/my.cnf文件用户组与用户、权限--使用root用户
cd /usr/local
chown mysqladmin:dba /etc/my.cnf
chmod 640 /etc/my.cnf
验证:
ll my.cnf
-rw-r----- 1 mysqladmin dba 2201 Dec 19 11:19:40 my.cnf
8、修改mysql安装文件用户组与用户、权限--使用root用户
chown -R mysqladmin:dba /usr/local/mysql
chmod -R 755 /usr/local/mysql
su - mysqladmin
pwd显示:/usr/local/mysql
9、创建arch目录--使用mysqladmin用户
cd /usr/local/mysql
mkdir arch
10、检查gcc、libaio、perl以及perl-devel包是否安装
rpm -qa|grep gcc libaio perl perl-devel
如未安装,则使用yum方式安装:yum -y install libaio、yum -y install gcc、yum -y install perl
11、二进制安装
scripts/mysql_install_db --user=mysqladmin --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
提示:
Installing MySQL system tables...2017-12-19 11:39:15 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
OK
Filling help tables...2017-12-19 11:39:15 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
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:
./bin/mysqladmin -u root password 'new-password'
./bin/mysqladmin -u root -h sht-sgmhadoopnn-01 password 'new-password'
Alternatively you can run:
./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 . ; ./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 ./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
12、启动mysql--使用mysqladmin用户
su - mysqladmin
cd /usr/local/mysql
rm -rf my.cnf
bin/mysqld_safe &
验证是否启动:ps -ef|grep mysqld、netstat -tulnp | grep mysql
13、登录mysql,并修改mysql中的root密码内容--使用mysqladmin用户
mysql
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
注:如mysql数据库名称,则退出(exit)使用:mysql -uroot -p,提示输入密码时直接回车
mysql> use mysql
mysql> update user set password=password('123456') where user='root';
mysql> select host,user,password from user;
mysql> delete from user where user='';
mysql> select host,user,password from user;
mysql> flush privileges;
若泽大数据交流群:671914634
用户
文件
提示
内容
密码
用户组
验证
二进制
方式
变量
数据
权限
环境
目录
配置
笔记
个人
名称
数据库
步骤
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
微信上发送文件在服务器保存多久
对中学生的网络安全教育的
信达网络安全ppt
怎么看电脑本地数据库账号密码
工资管理系统数据库总结
传奇服务器创建人物没有反应
古剑奇谭ol官方服务器
数据库查询分页语句mysql
网络安全防范具体是什么意思
服务器改密码不重启怎么让他生效
软件开发培训上哪学
微软网络安全工程师课程
重庆嵌入式软件开发哪里有
软件开发工程师多大年龄不能做
怎么连接外国服务器
linux服务器桌面
pda开发数据库用哪个
自助式软件开发平台
ps5港服绝地求生服务器满载
曲靖网络安全应急中心
2021公安招聘网络安全人员
网络技术维面试
网站换域名数据库修改
计算机网络管理和网络安全
视频 java 服务器
成长守护平台服务器错误
网络安全审查办法对苹果有何影响
网警开展网络安全执法
个人承包软件开发 发票
创媒网络技术部门