linux sql安装配置,linux安装mysql 5.6实时教程和配置

检查系统中是不是已安装过mysql。

rpm -qa | grep mysql

以下图:

a793085aa14709c0532c913f2cff5365.png

如果存在,则需要删除。

yum -y remove mysql*

继续检查1下是不是还存在mysql

rpm -qa | grep -i mysql

fe5f67aefa9738c19211862d4462d09a.png

然后下1步就是下载rpm包了。需要下载:

MySQL-client⑸.6.15⑴.el6.x86_64.rpm

MySQL-devel⑸.6.15⑴.el6.x86_64.rpm

MySQL-server⑸.6.15⑴.el6.x86_64.rpm

逐1履行命令:

wget http://cdn.mysql.com/archives/mysql⑸.6/MySQL-client⑸.6.15⑴.el6.x86_64.rpm

wget http://cdn.mysql.com/archives/mysql⑸.6/MySQL-devel⑸.6.15⑴.el6.x86_64.rpm

wget http://cdn.mysql.com/archives/mysql⑸.6/MySQL-server⑸.6.15⑴.el6.x86_64.rpm

a766f2046e3a43452d1f94aebcbf8aa0.png

接下来就是安装了分别顺次履行:

[root@iZ25in7iu0fZ rpm]# rpm -ivh MySQL-server⑸.6.15⑴.el6.x86_64.rpm

Preparing...                ########################################### [100%]

1:MySQL-server           ########################################### [100%]

2015-03-06 08:16:03 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

2015-03-06 08:16:03 28629 [Note] InnoDB: The InnoDB memory heap is disabled

2015-03-06 08:16:03 28629 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins

2015-03-06 08:16:03 28629 [Note] InnoDB: Compressed tables use zlib 1.2.3

2015-03-06 08:16:03 28629 [Note] InnoDB: Using Linux native AIO

2015-03-06 08:16:03 28629 [Note] InnoDB: Using CPU crc32 instructions

2015-03-06 08:16:03 28629 [Note] InnoDB: Initializing buffer pool, size = 128.0M

2015-03-06 08:16:03 28629 [Note] InnoDB: Completed initialization of buffer pool

2015-03-06 08:16:03 28629 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!

2015-03-06 08:16:03 28629 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB

2015-03-06 08:16:03 28629 [Note] InnoDB: Database physically writes the file full: wait...

2015-03-06 08:16:03 28629 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB

2015-03-06 08:16:04 28629 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB

2015-03-06 08:16:06 28629 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0

2015-03-06 08:16:06 28629 [Warning] InnoDB: New log files created, LSN=45781

2015-03-06 08:16:06 28629 [Note] InnoDB: Doublewrite buffer not found: creating new

2015-03-06 08:16:06 28629 [Note] InnoDB: Doublewrite buffer created

2015-03-06 08:16:06 28629 [Note] InnoDB: 128 rollback segment(s) are active.

2015-03-06 08:16:06 28629 [Warning] InnoDB: Creating foreign key constraint system tables.

2015-03-06 08:16:06 28629 [Note] InnoDB: Foreign key constraint system tables created

2015-03-06 08:16:06 28629 [Note] InnoDB: Creating tablespace and datafile system tables.

2015-03-06 08:16:06 28629 [Note] InnoDB: Tablespace and datafile system tables created.

2015-03-06 08:16:06 28629 [Note] InnoDB: Waiting for purge to start

2015-03-06 08:16:06 28629 [Note] InnoDB: 5.6.15 started; log sequence number 0

A random root password has been set. You will find it in '/root/.mysql_secret'.

2015-03-06 08:16:07 28629 [Note] Binlog end

2015-03-06 08:16:07 28629 [Note] InnoDB: FTS optimize thread exiting.

2015-03-06 08:16:07 28629 [Note] InnoDB: Starting shutdown...

2015-03-06 08:16:08 28629 [Note] InnoDB: Shutdown completed; log sequence number 1625977

2015-03-06 08:16:08 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

2015-03-06 08:16:08 28652 [Note] InnoDB: The InnoDB memory heap is disabled

2015-03-06 08:16:08 28652 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins

2015-03-06 08:16:08 28652 [Note] InnoDB: Compressed tables use zlib 1.2.3

2015-03-06 08:16:08 28652 [Note] InnoDB: Using Linux native AIO

2015-03-06 08:16:08 28652 [Note] InnoDB: Using CPU crc32 instructions

2015-03-06 08:16:08 28652 [Note] InnoDB: Initializing buffer pool, size = 128.0M

2015-03-06 08:16:08 28652 [Note] InnoDB: Completed initialization of buffer pool

2015-03-06 08:16:08 28652 [Note] InnoDB: Highest supported file format is Barracuda.

2015-03-06 08:16:08 28652 [Note] InnoDB: 128 rollback segment(s) are active.

2015-03-06 08:16:08 28652 [Note] InnoDB: Waiting for purge to start

2015-03-06 08:16:08 28652 [Note] InnoDB: 5.6.15 started; log sequence number 1625977

2015-03-06 08:16:08 28652 [Note] Binlog end

2015-03-06 08:16:08 28652 [Note] InnoDB: FTS optimize thread exiting.

2015-03-06 08:16:08 28652 [Note] InnoDB: Starting shutdown...

2015-03-06 08:16:10 28652 [Note] InnoDB: Shutdown completed; log sequence number 1625987

[root@iZ25in7iu0fZ rpm]# rpm -ivh MySQL-devel⑸.6.15⑴.el6.x86_64.rpm

Preparing...                ########################################### [100%]

1:MySQL-devel            ########################################### [100%]

[root@iZ25in7iu0fZ rpm]# rpm -ivh MySQL-client⑸.6.15⑴.el6.x86_64.rpm

Preparing...                ########################################### [100%]

1:MySQL-client           ########################################### [100%]

修改配置文件位置。

[root@iZ25in7iu0fZ rpm]# cp /usr/share/mysql/my-default.cnf /etc/my.cnf

初始化MySQL及设置密码cp /usr/share/mysql/my-default.cnf /etc/my.cnf

/usr/bin/mysql_install_db

cat /root/.mysql_secret

记录最后的密码

mysql -p ---输入记录的密码,便可登录mysql。

set password for'root'@'localhost'=password('新密码');flush privileges;

exit

设置自启动

chkconfig

mysql on

MySQL的默许安装位置

1

/var/lib/mysql/#数据库目录

2

/usr/share/mysql#配置文件目录

3

/usr/bin#相干命令目录

4

/etc/init.d/mysql#启动脚本

修改字符集和数据寄存目录

原来配置文件:

64798eea10178c06704e3fbbe8bce671.png

更改以后为:

# For advice on how to change settings please see

# http://dev.mysql.com/doc/refman/5.6/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.

[client]

port            = 3306

default-character-set=utf8

[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 = .....

datadir = /mnt/data/mysql

port = 3306

# server_id = .....

# socket = .....

lower_case_table_names=1

max_connections=1000

collation_server = utf8_general_ci

character_set_server = utf8

# default-character-set=utf8

# init_connect='SET NAMES utf8'

# 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

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

[mysql]

default-character-set = utf8

注意标红的。

然后就是修改数据库的数据目录:

vi /etc/init.d/mysql

6771fd4bdd9e52185ca4b7b51a4c3c37.png

重启数据库:

service mysql restart

大功告成。

8824faf5ee41a0ffecc53fd2735965f7.png

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值