linux mysql5.6.23 安装

1.上传mysql5.6.23安装包到/usr/local/目录下

      cd   /usr/local
     rz命令上传mysql-5.6.23-linux-glibc2.5-x86_64.tar.gz

2.解压安装包,和修改名字

	tar -zxvf  mysql-5.6.23-linux-glibc2.5-x86_64.tar.gz
	mv  mysql-5.6.23-linux-glibc2.5-x86_64   mysql

3.创建用户组和用户

	groupadd -g 101 dba
	useradd -u 514 -g dba -G root -d /usr/local/mysql mysqladmin

4.copy 环境变量配置文件至mysqladmin用户的home目录中,为了以下步骤配置个人环境变量

	cp   /etc/skel/.*    /usr/local/mysql 

5.修改/etc/my.cnf配置文件

	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

生产上
innodb_buffer_pool_size = 2048M(可以调大,一般是8G-12G都可以)

6.改变my.cmf的权限

chown  mysqladmin:dba /etc/my.cnf
chmod  640 /etc/my.cnf 

7.改变/usr/local/mysql目录权限

chown -R mysqladmin:dba /usr/local/mysql
chmod -R 755 /usr/local/mysql

注意:关于文件夹的修改 修改完成后 一定要cd进去 ll再看一下

8.创建binlog日志存储文件

[root@ruozedata001 ~]# su - mysqladmin
Last login: Fri Jun 28 14:01:40 CST 2019 on pts/2
ruozedata001:mysqladmin:/usr/local/mysql:>pwd
/usr/local/mysql
ruozedata001:mysqladmin:/usr/local/mysql:>mkdir   arch

9.执行安装脚本文件

scripts/mysql_install_db --user=mysqladmin  --basedir=/usr/local/mysql  --datadir=/usr/local/mysql/data
报错:Installing MySQL system tables..../bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory #缺少libaio.so 包
	 yum -y install libaio(安装libaio包)
scripts/mysql_install_db --user=mysqladmin  --basedir=/usr/local/mysql  --datadir=/usr/local/mysql/data

然后再执行上述安装命令

10.配置mysql服务的自动启动

#将服务文件拷贝到init.d下,并重命名为mysql
[root@ruozedata001 mysql]# cp  support-files/mysql.server  /etc/rc.d/init.d/mysql 
#赋予可执行权限
[root@ruozedata001 mysql]# chmod +x /etc/rc.d/init.d/mysql
#删除服务
[root@ruozedata001 mysql]#  chkconfig --del mysql
#添加服务
[root@ruozedata001 mysql]# chkconfig --add mysql
[root@ruozedata001 mysql]#  chkconfig --level 345 mysql on
[root@ruozedata001 mysql]#  vi /etc/rc.local(开机最先读取的配置文件)
	su - mysqladmin -c "/etc/init.d/mysql start"

11.修改环境变量

ruozedata001:mysqladmin:/usr/local/mysql:>cat .bash_profile 
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
    . ~/.bashrc
fi

# User specific environment and startup programs

export  MYSQL_HOME=/usr/local/mysql
export  PATH=${MYSQL_HOME}/bin:$PATH

unset USERNAME
set unmask to 022
umask 022

PS1=`uname -n`":"'$USER'":"'$PWD'":>";
export PS1
ruozedata001:mysqladmin:/usr/local/mysql:>

12.然后启动mysql

ruozedata001:mysqladmin:/usr/local/mysql:>/etc/init.d/mysql  start
Starting MySQL. SUCCESS! 
ruozedata001:mysqladmin:/usr/local/mysql:>

注意:这里必须要切换到mysqladmin这个服务才能够启动mysql

13登陆mysql并删除空用户和修改mysql的root用户的密码

ruozedata001:mysqladmin:/usr/local/mysql:>mysql -uroot -p 
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.23-log MySQL Community Server (GPL)

Copyright (c) 2000, 2015, 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> 
mysql> use mysql;
Database changed
mysql> delete  from  user where user='';
mysql>  update  user set password=password('123456') where user='root';
mysql>flush privileges;
注意:只要mysql数据库已装好,就最好删除空用户和修改root的密码,不然会造成很多的bug,尤其是mysql数据库重新安装了后

14.mysql数据库如果需要重新安装

service mysql stop
rm -rf /usr/local/mysql/arch/*
rm -rf /usr/local/mysql/data/*
scripts/mysql_install_db  \
--user=mysqladmin \
--basedir=/usr/local/mysql \
--datadir=/usr/local/mysql/data 
然后再好删除空用户和修改root的密码,不然会造成很多的bug.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
以下是MySQL 5.6.23的安装配置教程: 1. 首先,你需要下载MySQL 5.6.23。你可以从官方网站或其他可靠的资源下载它。 2. 下载完成后,你可以开始安装MySQL。按照安装程序的指示进行操作,直到安装完成。 3. 安装完成后,你需要配置环境变量。打开“我的电脑”->“属性”->“高级”->“环境变量”,在系统变量中找到PATH,并在其后面添加你的MySQL安装路径。 4. 确保你已经按照上述步骤正确安装和配置MySQL。你可以通过检查是否有一个带有绿色勾的MySQL服务来确认安装是否成功。 通过以上步骤,你就可以成功地安装和配置MySQL 5.6.23了。希望对你有所帮助!<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [mysql 5.6.23 安装配置环境变量教程](https://download.csdn.net/download/weixin_38601215/14907946)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* *3* [MySQL5.6下载安装、配置环境变量教程(官网)](https://blog.csdn.net/weixin_44024740/article/details/121940858)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值