SQL Life

MySql for Linux部署文档

时间:2014/9/30 18:01:13  作者:solgle  来源:www.solgle.com  查看:1706  评论:0
内容摘要:MySql for Linux 部署文档一:运行环境Linux version Oracle Enterprise Linux 6.5 64bitMysql version 6.5 64bit谀:清理环境1:卸载linux中已有的mysql文件库嬀爀漀漀琀@mysqls...

MySql for Linux 部署文档

MySql for Linux 部署文档,本文出自:http://www.solgle.com/news/142.html
一:运行环境

Linux version Oracle Enterprise Linux 6.5 64bit

Mysql version 6.5 64bit

 

二:清理环境

 

1:卸载linux中已有的mysql文件库

[root@www.solgle.com soft]# rpm -qa|grep mysql

qt-mysql-4.6.2-26.el6_4.x86_64

mysql-5.1.71-1.el6.x86_64

mysql-server-5.1.71-1.el6.x86_64

……

[root@www.solgle.com soft]# rpm -e mysql-libs-*  --nodeps

[root@www.solgle.com soft]# rpm -e qt-mysql-4.6.2-26.el6_4.x86_64  --nodeps

[root@www.solgle.com soft]# rpm -qa|grep mysql

mysql-5.1.71-1.el6.x86_64

mysql-server-5.1.71-1.el6.x86_64

 

[root@www.solgle.com soft]# rpm -e mysql-5.1.71-1.el6.x86_64  --nodeps

[root@www.solgle.com soft]# rpm -e mysql-server-5.1.71-1.el6.x86_64  --nodeps

 

2:最后查看已经卸载完毕,没有列出项

[root@www.solgle.com soft]# rpm -qa|grep mysql

[root@www.solgle.com soft]#

 

三:开始安装rpm

 

1:安装mysql服务

[root@www.solgle.com soft]# rpm -ivh MySQL-server-advanced-5.6.20-1.el6.x86_64.rpm

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

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

2014-09-29 14:45:46 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

2014-09-29 14:45:47 41957 [Note] InnoDB: Using atomics to ref count buffer pool pages

2014-09-29 14:45:47 41957 [Note] InnoDB: The InnoDB memory heap is disabled

2014-09-29 14:45:47 41957 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins

2014-09-29 14:45:47 41957 [Note] InnoDB: Memory barrier is not used

2014-09-29 14:45:47 41957 [Note] InnoDB: Compressed tables use zlib 1.2.3

2014-09-29 14:45:47 41957 [Note] InnoDB: Using Linux native AIO

2014-09-29 14:45:47 41957 [Note] InnoDB: Not using CPU crc32 instructions

2014-09-29 14:45:47 41957 [Note] InnoDB: Initializing buffer pool, size = 128.0M

2014-09-29 14:45:47 41957 [Note] InnoDB: Completed initialization of buffer pool

2014-09-29 14:45:47 41957 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!

2014-09-29 14:45:47 41957 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB

2014-09-29 14:45:47 41957 [Note] InnoDB: Database physically writes the file full: wait...

2014-09-29 14:45:48 41957 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB

2014-09-29 14:45:58 41957 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB

2014-09-29 14:46:12 41957 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0

2014-09-29 14:46:12 41957 [Warning] InnoDB: New log files created, LSN=45781

2014-09-29 14:46:12 41957 [Note] InnoDB: Doublewrite buffer not found: creating new

2014-09-29 14:46:12 41957 [Note] InnoDB: Doublewrite buffer created

2014-09-29 14:46:12 41957 [Note] InnoDB: 128 rollback segment(s) are active.

2014-09-29 14:46:12 41957 [Warning] InnoDB: Creating foreign key constraint system tables.

2014-09-29 14:46:12 41957 [Note] InnoDB: Foreign key constraint system tables created

2014-09-29 14:46:12 41957 [Note] InnoDB: Creating tablespace and datafile system tables.

2014-09-29 14:46:12 41957 [Note] InnoDB: Tablespace and datafile system tables created.

2014-09-29 14:46:12 41957 [Note] InnoDB: Waiting for purge to start

2014-09-29 14:46:12 41957 [Note] InnoDB: 5.6.20 started; log sequence number 0

2014-09-29 14:46:12 41957 [Note] RSA private key file not found: /var/lib/mysql//private_key.pem. Some authentication plugins will not work.

2014-09-29 14:46:12 41957 [Note] RSA public key file not found: /var/lib/mysql//public_key.pem. Some authentication plugins will not work.

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

2014-09-29 14:46:13 41957 [Note] Binlog end

2014-09-29 14:46:13 41957 [Note] InnoDB: FTS optimize thread exiting.

2014-09-29 14:46:13 41957 [Note] InnoDB: Starting shutdown...

2014-09-29 14:46:15 41957 [Note] InnoDB: Shutdown completed; log sequence number 1625977

2014-09-29 14:46:15 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

2014-09-29 14:46:15 41981 [Note] InnoDB: Using atomics to ref count buffer pool pages

2014-09-29 14:46:15 41981 [Note] InnoDB: The InnoDB memory heap is disabled

2014-09-29 14:46:15 41981 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins

2014-09-29 14:46:15 41981 [Note] InnoDB: Memory barrier is not used

2014-09-29 14:46:15 41981 [Note] InnoDB: Compressed tables use zlib 1.2.3

2014-09-29 14:46:15 41981 [Note] InnoDB: Using Linux native AIO

2014-09-29 14:46:15 41981 [Note] InnoDB: Not using CPU crc32 instructions

2014-09-29 14:46:15 41981 [Note] InnoDB: Initializing buffer pool, size = 128.0M

2014-09-29 14:46:15 41981 [Note] InnoDB: Completed initialization of buffer pool

2014-09-29 14:46:15 41981 [Note] InnoDB: Highest supported file format is Barracuda.

2014-09-29 14:46:15 41981 [Note] InnoDB: 128 rollback segment(s) are active.

2014-09-29 14:46:15 41981 [Note] InnoDB: Waiting for purge to start

2014-09-29 14:46:15 41981 [Note] InnoDB: 5.6.20 started; log sequence number 1625977

2014-09-29 14:46:15 41981 [Note] RSA private key file not found: /var/lib/mysql//private_key.pem. Some authentication plugins will not work.

2014-09-29 14:46:15 41981 [Note] RSA public key file not found: /var/lib/mysql//public_key.pem. Some authentication plugins will not work.

2014-09-29 14:46:16 41981 [Note] Binlog end

2014-09-29 14:46:16 41981 [Note] InnoDB: FTS optimize thread exiting.

2014-09-29 14:46:16 41981 [Note] InnoDB: Starting shutdown...

2014-09-29 14:46:17 41981 [Note] InnoDB: Shutdown completed; log sequence number 1625987

A RANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER !You will find that password in '/root/.mysql_secret'.

You must change that password on your first connect,

no other statement but 'SET PASSWORD' will be accepted.

See the manual for the semantics of the 'password expired' flag.

 

Also, the account for the anonymous user has been removed.

 

In addition, you can run:

  /usr/bin/mysql_secure_installation

which will also give you the option of removing the test database.

This is strongly recommended for production servers.

See the manual for more instructions.

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 /usr/my.cnf and

will be used by default by the server when you start it.

You may edit this file to change server settings

[root@www.solgle.com soft]#

 

2:安装客户端

[root@www.solgle.com soft]# rpm -ivh MySQL-client-advanced-5.6.20-1.el6.x86_64.rpm

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

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

[root@www.solgle.com soft]# rpm -ivh MySQL-devel-advanced-5.6.20-1.el6.x86_64.rpm 

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

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

[root@www.solgle.com soft]#

 

 

四:配置mysql

 

1:配置密码报错

[root@www.solgle.com soft]# mysql -u root -p

Enter password:

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

 

2:解决该错误

[root@www.solgle.com soft]# vi /usr/my.cnf

……

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

###add next item###

skip-grant-tables

wq!

[root@www.solgle.com soft]#

 

3:重启服务

[root@www.solgle.com soft]# service mysql restart

Shutting down MySQL...                                     [ç¡®å®]

^[[?1;2cStarting MySQL................                     [ç¡®å®]

 

4:设置初始密码

[root@www.solgle.com ~]# mysql -u root -p

Enter password:

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 4

Server version: 5.6.20-enterprise-commercial-advanced MySQL Enterprise Server - Advanced Edition (Commercial)

 

Copyright (c) 2000, 2014, 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> set password=password('111111');    

Query OK, 0 rows affected (0.02 sec)

 

5:设置远程登录

mysql> show databases;

+--------------------+

| Database           |

+--------------------+

| information_schema |

| mysql              |

| performance_schema |

| test               |

+--------------------+

4 rows in set (0.01 sec)

 

mysql> use mysql

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with -A

 

Database changed

mysql> update user set password=password('111111') where user='root';

Query OK, 4 rows affected (0.03 sec)

Rows matched: 4  Changed: 4  Warnings: 0

 

mysql> update user set host='%’ where user ='root' and host='localhost';

Query OK, 1 rows affected (0.01 sec)

Rows matched: 1  Changed: 1  Warnings: 0

 

mysql> flush privileges;

Query OK, 0 rows affected (0.02 sec)

 

mysql> select host,user,password from user;

+-----------+------+-------------------------------------------+

| host      | user | password                                  |

+-----------+------+-------------------------------------------+

| %         | root | *FD571203974BA9AFE270FE62151AE967ECA5E0AA |

| www.solgle.com  | root | *FD571203974BA9AFE270FE62151AE967ECA5E0AA |

| 127.0.0.1 | root | *FD571203974BA9AFE270FE62151AE967ECA5E0AA |

| ::1       | root | *FD571203974BA9AFE270FE62151AE967ECA5E0AA |

+-----------+------+-------------------------------------------+

4 rows in set (0.01 sec)

 

mysql> quit

Bye


6:注释掉刚才加的那一行
[root@www.solgle.com soft]# vi /usr/my.cnf

……

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

###delete next item only###
##skip-grant-tables

wq!


7:重启mysql服务

[root@www.solgle.com soft]# service mysql restart

Shutting down MySQL...                                     [ç¡®å®]

^[[?1;2cStarting MySQL................                     [ç¡®å®]

 

五:设置mysql开机自动启动

[root@www.solgle.com soft]# chkconfig mysql on  

[root@www.solgle.com soft]#

 

 

六:管理或设置防火墙

 

[root@www.solgle.com ~]# service iptables stop

iptablesï¼å°é¾è®¾ç½®ä¸ºæ¿ç­ ACCEPTï¼filter ^[[?1;2c^[[?1;2c[ç¡®å®]

iptablesï¼æ¸

é¤é²ç«å¢è§

^[[?1;2c  åï¼^[[¸è½½æ¨¡åï¼^[[?1;2c^[[?1;2c                 [ç¡®å®]

[root@www.solgle.com ~]# chkconfig iptables off;

[root@www.solgle.com ~]#


---至于中文乱码的问题,是ssh工具的问题,在服务器本机上面文字显示正常,不过改用xshell工具时,设置编码utf8后,中文显示正常。
 

标签:mysql部署文档 mysql安装 

solgle.com 版权所有,欢迎分享!!!

相关评论
 img1 img2 img3 img4 img5 img6 img7 img8 img9 img10
评论者:      验证码:  点击获取验证码
   Copyright © 2013-2028 solgle.com,All rights reserved.[solgle.com] 公安机关备案号:51010802000219
Email:solgle@solgle.com; weixin:cd1008610000 ICP:蜀ICP备14011070号-1