linux安装glibc的mysql_linux安装glibc版mysql,实测成功 333333333333333-Go语言中文社区...

废话少说:

一.准备工作:

1.添加mysql用户组

groupadd mysql

2.添加mysql用户

useradd -g mysql mysql

2.解压mysql 并移动到usr/local/下

tar zxvf mysql-5.7.16-linux-glibc2.5-x86_64.tar.gz

mv mysql-5.7.16-linux-glibc2.5-x86_64 /usr/local/mysql

创建data文件夹

mkdir data

3.改变文件夹所有者

chown -R mysql /usr/local/mysql

chgrp -R mysql /usr/local/mysql

4.安装mysql

cd /usr/local/mysql #进入安装目录

cd ../bin

./mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data

[WARNING] mysql_install_dbisdeprecated. Please consider switchingtomysqld --initialize 2015-11-10 02:09:23

[WARNING] The bootstrap log isn't empty: 2015-11-10 02:09:23

[WARNING] 2015-11-10T10:09:18.114182Z 0

[Warning] --bootstrap is deprecated. Please consider using --initialize instead 2015-11-10T10:09:18.129343Z 0

[Warning] Changed limits: max_open_files: 1024 (requested 5000) 2015-11-10T10:09:18.129408Z 0

[Warning] Changed limits: table_open_cache: 431 (requested 2000)

mysql5.7新特性:由上面可以看出, mysql_install_db 已经不再推荐使用了,建议改成 mysqld --initialize 完成实例初始化

./mysqld --user=mysql--basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --initialize

[Warning] TIMESTAMPwithimplicit DEFAULTvalueis deprecated. Please use--explicit_defaults_for_timestamp server option (see documentation for more details). 2016-04-08T01:47:59.945537Z 0

[Warning] InnoDB: New log files created, LSN=45790 2016-04-08T01:48:00.333528Z 0 [Warning] InnoDB: Creatingforeignkeyconstraint system tables. 2016-04-08T01:48:00.434908Z 0

[Warning] Noexisting UUID has been found, so we assume that thisis the firsttimethat this server has been started. Generating a new UUID: ece26421-fd2b-11e5-a1e3-00163e001e5c. 2016-04-08T01:48:00.440125Z 0

[Warning] Gtid table is not ready tobe used.Table 'mysql.gtid_executed'cannot be opened. 2016-04-08T01:48:00.440904Z 1

[Note] A temporarypasswordis generated forroot@localhost:**mjT,#x_5sW

产生一个临时的密码,登录mysql的时候需要用到。

5.测试安装

cd /usr/lcoal/mysql/support-files

./mysql.server start

显示 start Starting MySQL.. OK!说明成功

6.设置mysql启动初始化文件

cd /usr/local/mysql/support-files

cp my-default.cnf /etc/my.cnf

配置my.cnf

vim /etc/my.cnf

For advice on how to change settings please see

*** 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]

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 = /usr/local/mysql

datadir = /usr/local/mysql/data

port = 3306

server_id = ...

socket = /tmp/mysql.sock

pid-file = /usr/local/mysql/mysql.pid

max_connections = 1500

read_buffer_size = 2M

character_set_server=utf8

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

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

[client]

default-character-set=utf8

7.设置mysql开机自启动

cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld/

chmod 755 /etc/init.d/mysqld # 增加执行权限

chkconfig --list mysqld # 检查自启动项列表中没有mysqld这个,

chkconfig --add mysqld # 如果没有就添加mysqld:

chkconfig mysqld on # 用这个命令设置开机启动:

至此mysql全部安装完毕

运行命令:service mysqld start 启动mysql

./usr/local/mysql/bin/mysql -uroot -p

PASSWORD: **mjT,#x_5sW

输入刚产生的临时密码

修改 root 密码 set password for 'root'@'localhost' = '你的密码'

ok!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值