linux下安装mysql的问题解决

最近试了下在Linux下安装mysql,我只选了server和client两个组件,没有装其他的组件. 安装包的下载可以参见 http://www.mysql.com/downloads/ server端的安装:

[root@oel2 install_mysql]# rpm -ivh MySQL-server-advanced-5.6.14-1.rhel5.i386.rpm
Preparing...                ########################################### [100%]
   1:MySQL-server-advanced  ########################################### [100%]
2013-12-08 21:49:03 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2013-12-08 21:49:03 17530 [Note] InnoDB: The InnoDB memory heap is disabled
2013-12-08 21:49:03 17530 [Note] InnoDB: Mutexes and rw_locks use InnoDB's own implementation
2013-12-08 21:49:03 17530 [Note] InnoDB: Compressed tables use zlib 1.2.3
2013-12-08 21:49:03 17530 [Note] InnoDB: Using Linux native AIO
2013-12-08 21:49:03 17530 [Note] InnoDB: Not using CPU crc32 instructions
2013-12-08 21:49:03 17530 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2013-12-08 21:49:03 17530 [Note] InnoDB: Completed initialization of buffer pool
2013-12-08 21:49:03 17530 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2013-12-08 21:49:03 17530 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2013-12-08 21:49:03 17530 [Note] InnoDB: Database physically writes the file full: wait...
2013-12-08 21:49:04 17530 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
2013-12-08 21:49:06 17530 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
2013-12-08 21:49:09 17530 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2013-12-08 21:49:09 17530 [Warning] InnoDB: New log files created, LSN=45781
2013-12-08 21:49:09 17530 [Note] InnoDB: Doublewrite buffer not found: creating new
2013-12-08 21:49:09 17530 [Note] InnoDB: Doublewrite buffer created
2013-12-08 21:49:09 17530 [Note] InnoDB: 128 rollback segment(s) are active.
2013-12-08 21:49:10 17530 [Warning] InnoDB: Creating foreign key constraint system tables.
2013-12-08 21:49:10 17530 [Note] InnoDB: Foreign key constraint system tables created
2013-12-08 21:49:10 17530 [Note] InnoDB: Creating tablespace and datafile system tables.
2013-12-08 21:49:10 17530 [Note] InnoDB: Tablespace and datafile system tables created.
2013-12-08 21:49:10 17530 [Note] InnoDB: Waiting for purge to start
2013-12-08 21:49:10 17530 [Note] InnoDB: 5.6.14 started; log sequence number 0
2013-12-08 21:49:10 17530 [Note] RSA private key file not found: /var/lib/mysql//private_key.pem. Some authentication plugins will not work.
2013-12-08 21:49:10 17530 [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'.
2013-12-08 21:49:12 17530 [Note] Binlog end
2013-12-08 21:49:12 17530 [Note] InnoDB: FTS optimize thread exiting.
2013-12-08 21:49:12 17530 [Note] InnoDB: Starting shutdown...
2013-12-08 21:49:13 17530 [Note] InnoDB: Shutdown completed; log sequence number 1625977

2013-12-08 21:49:13 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2013-12-08 21:49:13 17568 [Note] InnoDB: The InnoDB memory heap is disabled
2013-12-08 21:49:13 17568 [Note] InnoDB: Mutexes and rw_locks use InnoDB's own implementation
2013-12-08 21:49:13 17568 [Note] InnoDB: Compressed tables use zlib 1.2.3
2013-12-08 21:49:13 17568 [Note] InnoDB: Using Linux native AIO
2013-12-08 21:49:13 17568 [Note] InnoDB: Not using CPU crc32 instructions
2013-12-08 21:49:13 17568 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2013-12-08 21:49:13 17568 [Note] InnoDB: Completed initialization of buffer pool
2013-12-08 21:49:13 17568 [Note] InnoDB: Highest supported file format is Barracuda.
2013-12-08 21:49:13 17568 [Note] InnoDB: 128 rollback segment(s) are active.
2013-12-08 21:49:13 17568 [Note] InnoDB: Waiting for purge to start
2013-12-08 21:49:13 17568 [Note] InnoDB: 5.6.14 started; log sequence number 1625977
2013-12-08 21:49:13 17568 [Note] RSA private key file not found: /var/lib/mysql//private_key.pem. Some authentication plugins will not work.
2013-12-08 21:49:13 17568 [Note] RSA public key file not found: /var/lib/mysql//public_key.pem. Some authentication plugins will not work.
2013-12-08 21:49:13 17568 [Note] Binlog end
2013-12-08 21:49:13 17568 [Note] InnoDB: FTS optimize thread exiting.
2013-12-08 21:49:13 17568 [Note] InnoDB: Starting shutdown...
2013-12-08 21:49:15 17568 [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 with the /usr/bin/mysqlbug script!
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

client端的安装:

[root@oel2 install_mysql]# rpm -ivh MySQL-client-advanced-5.6.14-1.rhel5.i386.rpm
Preparing...                ########################################### [100%]
   1:MySQL-client-advanced  ########################################### [100%]

[mysql@oel2 bin]$ yum list installed mysql\*
Loaded plugins: security
Installed Packages
MySQL-client-advanced.i386                     5.6.14-1.rhel5                      installed
MySQL-server-advanced.i386                     5.6.14-1.rhel5                      installed
[mysql@oel2 bin]$ 

启动服务

[root@oel2 ~]# service mysql start
Starting MySQL..                                           [  OK  ]

检查mysql端口3306是否正常

[root@oel2 ~]# netstat -nat|grep 3306 tcp 0 0 :::3306 :::* LISTEN [ 连接的时候总是报错。错误大概有如下几种。 [root@oel2 ~]# mysql -u root ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) [root@oel2 ~]# mysql -u root ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) [root@oel2 ~]# mysqladmin -u root -p password '123456' Enter password: mysqladmin: connect to server at 'localhost' failed error: 'Access denied for user 'root'@'localhost' (using password: YES)' [root@oel2 ~]# /etc/init.d/mysql stop Shutting down MySQL.. [ OK ] [root@oel2 ~]# mysqld_safe --user=mysql --skip-grant-tables --skip-networking & [1] 26352 131208 22:58:35 mysqld_safe Logging to '/var/lib/mysql/oel2.err'. 131208 22:58:35 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql [root@oel2 ~]# mysql -u root mysql Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 Server version: 5.6.14-enterprise-commercial-advanced MySQL Enterprise Server - Advanced Edition (Commercial) Copyright (c) 2000, 2013, 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> update user set password=password('mysql') where user='root'; Query OK, 4 rows affected (0.08 sec) Rows matched: 4 Changed: 4 Warnings: 0 mysql> flush privileges; Query OK, 0 rows affected (0.05 sec) mysql> quit Bye [root@oel2 ~]# /etc/init.d/mysql restart Shutting down MySQL..131208 22:59:59 mysqld_safe mysqld from pid file /var/lib/mysql/oel2.pid ended [ OK ] Starting MySQL.. [ OK ] [1]+ Done mysqld_safe --user=mysql --skip-grant-tables --skip-networking [root@oel2 ~]# 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.14-enterprise-commercial-advanced Copyright (c) 2000, 2013, 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> show databases; ERROR 1820 (HY000): You must SET PASSWORD before executing this statement mysql> SET PASSWORD = PASSWORD('mysql'); Query OK, 0 rows affected (0.00 sec) mysql> create database test; ERROR 1007 (HY000): Can't create database 'test'; database exists mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | test | +--------------------+ 4 rows in set (0.01 sec)

原文发布于微信公众号 - 杨建荣的学习笔记(jianrong-notes)

原文发表时间:2014-03-11

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

发表于

我来说两句

0 条评论
登录 后参与评论

相关文章

来自专栏数据之美

Hive 基础(2):库、表、字段、交互式查询的基本操作

1、命令行操作 (1)打印查询头,需要显示设置: set hive.cli.print.header=true; (2)加"--",其后的都被认为是注释...

70910
来自专栏Greenplum

Greenplum gpload命令使用

Runs a load job as defined in a YAML formatted control file.

4581
来自专栏个人分享

Spark工程开发常用函数与方法(Scala语言)

import org.apache.spark.{SparkContext, SparkConf} import org.apache.spark.sql.{S...

1652
来自专栏java相关

使用shell脚本生成数据库markdown文档

学习shell脚本编程的一次实践,通过shell脚本生成数据库的markdown文档,代码如下:

1975
来自专栏杨建荣的学习笔记

关于sql_profile中的绑定变量(r4笔记第57天)

使用sql_profile来调优一些紧急的性能sql可以起到立竿见影的效果,如果sql语句本身结构就很清晰,简单,略作修改就能得到调优后的sql语句。 但是如果...

3706
来自专栏MYSQL轻松学

Mysql索引长度计算

(root:hostname:Fri May 29 14:10:50 2015)[liangxl]> show create table liang_2; +-...

4065
来自专栏ASP.NET MVC5 后台权限管理系统

ASP.NET MVC5+EF6+EasyUI 后台管理系统(35)-文章发布系统②-构建项目

注:阅读本文,需要阅读本系列的之前文章 代码生成器下载地址(文章开头处)  接下来我们建立数据库的表和各层的代码 我们只需要两张表,文章列表(MIS_Artic...

2569
来自专栏哲学驱动设计

Rafy 中的 Linq 查询支持(根据聚合子条件查询聚合父)

为了提高开发者的易用性,Rafy 领域实体框架在很早开始就已经支持使用 Linq 语法来查询实体了。但是只支持了一些简单的、常用的条件查询,支持的力度很有限。特...

1757
来自专栏技术之路

使用Linq to Sql 创建数据库和表

1.建一个类Article 1 using System.Data.Linq.Mapping; 2 3 4 5 [Table(Name =...

2057
来自专栏技术小站

MySQL之char、varchar和text的设计

最近有表结构设计中出现了varchar(10000)的设计引起了大家的讨论,我们下面就来分析分析。

1372

扫码关注云+社区

领取腾讯云代金券