ERROR: 1005 Can't create table 'tmp_db' (errno: 13)

本文涉及的产品
云数据库 RDS MySQL Serverless,0.5-2RCU 50GB
简介:

一、实验环境  

环境:CentOS6.5

软件:mysql-5.5.32-linux2.6-x86_64


二、实验步骤  

二进制包安装mysql数据库,二进制安装无需编译,即直接解压放置安装的目录即可

1)二进制安装mysql5.5.32-linux2.6-x86_64.tar.gz ,解压。
tar xf mysql-5.5.32-linux2.6-x86_64.tar.gz 

mv mysql-5.5.32-linux2.6-x86_64 /application/mysql

2)创建mysql用户  
useradd mysql -s /sbin/nologin/ -M 

3)授权/application/mysql
chown -R mysql.mysql /application/mysql

4)初始化数据库
cd /application/mysql

mysql]# ./scripts/mysql_install_db --user=mysql --basedir=/application/mysql --datadir=/application/mysql/data/ 
WARNING: The host 'lnmp01' could not be looked up with resolveip.
This probably means that your libc libraries are not 100 % compatible
with this binary MySQL version. The MySQL daemon, mysqld, should work
normally with the exception that host name resolving will not work.
This means that you should use IP addresses instead of hostnames
when specifying MySQL privileges !
Installing MySQL system tables...
160609 22:14:24 [Note] /application/mysql/bin/mysqld (mysqld 5.5.49) starting as process 10430 ...
ERROR: 1005  Can't create table 'tmp_db' (errno: 13)
160609 22:14:24 [ERROR] Aborting

160609 22:14:24 [Note] /application/mysql/bin/mysqld: Shutdown complete


Installation of system tables failed!  Examine the logs in
/application/mysql/data/ for more information.

You can try to start the mysqld daemon with:

    shell> /application/mysql/bin/mysqld --skip-grant &

and use the command line tool /application/mysql/bin/mysql
to connect to the mysql database and look at the grant tables:

    shell> /application/mysql/bin/mysql -u root mysql
    mysql> show tables

Try 'mysqld --help' if you have problems with paths.  Using --log
gives you a log in /application/mysql/data/ that may be helpful.

Please consult the MySQL manual section
'Problems running mysql_install_db', and the manual section that
describes problems on your OS.  Another information source are the
MySQL email archives available at http://lists.mysql.com/.

Please check all of the above before submitting a bug report
at http://bugs.mysql.com/

如出现上诉错误,原因是mysql无法向/tmp/目录写入'tmp_db',解决方法:给/tmp目录授权:chown -R mysql.mysql /tmp/,再次初始化即可。   

Installing MySQL system tables...
160610  0:36:37 [Note] /application/mysql//bin/mysqld (mysqld 5.5.49) starting as process 11463 ...
OK
Filling help tables...
160610  0:36:37 [Note] /application/mysql//bin/mysqld (mysqld 5.5.49) starting as process 11470 ...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

出现两个OK代表mysql数据库安装成功。 


5)生成配置文件    
\cp /application/mysql/support-files/mysql-small.cnf /etc/my.cnf  

6)配置启动mysql    
sed -i 's#/usr/local/mysql#/application/mysql#g' /application/mysql/bin/mysqld_safe 

/application/mysql/bin/mysqld_safe & 后台启动mysql    

7)写入环境变量  
vi /etc/profile 

PATH="/application/mysql/bin:$PATH"

source /etc/profile  

或者
root@lnmp01 application]# cp /application/mysql/bin/* /usr/local/sbin/
[root@lnmp01 application]# which mysql
/usr/local/sbin/mysql

8)修改启动方法

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

 sed -i 's#/usr/local/mysql#/application/mysql#g' /etc/init.d/mysqld 

 chmod +x /etc/init.d/mysqld

 chkconfig mysqld on  

 /etc/init.d/mysqld start 

9.登录mysql   
[root@lnmp01 application]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.5.49 MySQL Community Server (GPL)

Copyright (c) 2000, 2016, 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> 


10.设置密码和更改密码 
/application/mysql/bin/mysqladmin -u root -password 'new-password'
/application/mysql//bin/mysqladmin -u root -h lnmp01 password 'new-password'

mysqladmin -uroot password "chen"  ---设置密码
mysqladmin -uroot -pchen password "chen123"---修改密码



本文转自chengong1013 51CTO博客,原文链接:http://blog.51cto.com/purify/1790522,如需转载请自行联系原作者

相关实践学习
基于CentOS快速搭建LAMP环境
本教程介绍如何搭建LAMP环境,其中LAMP分别代表Linux、Apache、MySQL和PHP。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助     相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
相关文章
|
5月前
|
SQL 关系型数据库 数据库
DB2 exception: Cannot create PoolableConnectionFactory SQLCODE=-142
DB2 exception: Cannot create PoolableConnectionFactory SQLCODE=-142
|
5月前
|
SQL 关系型数据库 数据库
DB2 SQL Error: SQLCODE=-302, SQLSTATE=22001, SQLERRMC=null
DB2 SQL Error: SQLCODE=-302, SQLSTATE=22001, SQLERRMC=null
111 0
|
存储 关系型数据库 MySQL
MySQL问题解决[Err] 1005 - Can't create table '.\ \#sql-b34_61.frm' (errno: 150)M
MySQL问题解决[Err] 1005 - Can't create table '.\ \#sql-b34_61.frm' (errno: 150)M
364 0
|
关系型数据库 MySQL 数据库
[Err] 1143 - SELECT command denied to user 'XX'@'%' for column 'XXX' in table 'XX'
[Err] 1143 - SELECT command denied to user 'XX'@'%' for column 'XXX' in table 'XX'
219 0
[Err] 1143 - SELECT command denied to user 'XX'@'%' for column 'XXX' in table 'XX'
|
存储 关系型数据库 MySQL
|
关系型数据库 MySQL 存储
MySQL 异常-- 1005 - Can't create table '.\blog\category.frm' (errno: 150)
异常 异常.png 原因 外键表类型不匹配或者数据库存储引擎不一致.
1278 0
|
MySQL 关系型数据库 网络安全