MYSQL5.7.19二进制包安装

来源:互联网 发布:dota2 mac版怎么下载 编辑:程序博客网 时间:2024/05/21 09:42
  • 创建mysql组和用户
groupadd mysqluseradd -r -g mysql mysql
  • 下载MYSQL5.7.19二进制包,上传至服务器的usr/local目录下
cd /usr/localll
  • 解压MYSQL5.7.19二进制包
tar -zxvf /Ultrapower/test/mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz
  • 重命名文件夹信息
mv mysql-5.7.19-linux-glibc2.12-x86_64 mysql
  • 更改所属的组和用户
chown -R mysql mysql/chgrp -R mysql mysql/
  • 解压之后的MYSQL文件包含的内容
cd mysql/ll
  • 创建my_default.cnf配置文件

    code:my_default.cnf

# For advice on how to change settings please see# http://dev.mysql.com/doc/refman/5.7/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.[mysqld]sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES # 一般配置选项basedir = /usr/local/mysqldatadir = /usr/local/mysql/dataport = 3306socket = /var/run/mysqld/mysqld.sockcharacter-set-server=utf8back_log = 300max_connections = 3000max_connect_errors = 50table_open_cache = 4096max_allowed_packet = 32M#binlog_cache_size = 4Mmax_heap_table_size = 128Mread_rnd_buffer_size = 16Msort_buffer_size = 16Mjoin_buffer_size = 16Mthread_cache_size = 16query_cache_size = 128Mquery_cache_limit = 4Mft_min_word_len = 8thread_stack = 512Ktransaction_isolation = REPEATABLE-READtmp_table_size = 128M#log-bin=mysql-binlong_query_time = 6server_id=1innodb_buffer_pool_size = 1Ginnodb_thread_concurrency = 16innodb_log_buffer_size = 16Minnodb_log_file_size = 512Minnodb_log_files_in_group = 3innodb_max_dirty_pages_pct = 90innodb_lock_wait_timeout = 120innodb_file_per_table = on[mysqldump]quickmax_allowed_packet = 32M[mysql]no-auto-rehashdefault-character-set=utf8safe-updates[myisamchk]key_buffer = 16Msort_buffer_size = 16Mread_buffer = 8Mwrite_buffer = 8M[mysqlhotcopy]interactive-timeout[mysqld_safe]open-files-limit = 8192[client]/bin/bash: Q: command not found
  • 将my_default.cnf上传至support-files文件夹中
cp my_default.cnf /usr/local/mysql/support-files
  • 创建data文件夹
cd usr/local/mysqlmkdir data 
  • 注册和初始化MYSQL服务
bin/mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/
  • 复制上述的my_default.cnf和mysql.server配置文件到etc目录,它这里提示是否覆盖,输入Y覆盖
cp -a /usr/local/mysql/support-files/my_default.cnf /etc/my.cnfcp -a /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
  • 启动MYSQL服务
cd bin/./mysql_safe --user=mysql/etc/init.d/mysqld restart
  • 连接至MYSQL,默认没有密码,直接回车后连接至MYSQL
./mysql -u root -p
  • 修改MYSQL的root密码
 set password = password('123456');
  • 修改可远程访问
 update user set host = '%' where user = 'root';
  • 重启MYSQL服务
 /etc/init.d/mysqld restart
原创粉丝点击