mysql初始化登录报错解决-1

本文涉及的产品
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
RDS MySQL Serverless 高可用系列,价值2615元额度,1个月
简介:

场景还原:

初始化

#/usr/local/webserver/mysql/bin/mysql_install_db --user=mysql --basedir=/usr/local/webserver/mysql/ --datadir=/home/mysqldata

Installing MySQL system tables...
150205 11:48:00 [Note] Flashcache bypass: disabled
150205 11:48:00 [Note] Flashcache setup error is : ioctl failed

OK
Filling help tables...
150205 11:48:00 [Note] Flashcache bypass: disabled
150205 11:48:00 [Note] Flashcache setup error is : ioctl failed

OK

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

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/usr/local/webserver/mysql//bin/mysqladmin -u root password 'new-password'
/usr/local/webserver/mysql//bin/mysqladmin -u root -h kooxoo17.ktep3.kuxun.cn password 'new-password'

Alternatively you can run:
/usr/local/webserver/mysql//bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd /usr/local/webserver/mysql/ ; /usr/local/webserver/mysql//bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd /usr/local/webserver/mysql//mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/local/webserver/mysql//scripts/mysqlbug script!

Percona recommends that all production deployments be protected with a support
contract (http://www.percona.com/mysql-suppport/) to ensure the highest uptime,
be eligible for hot fixes, and boost your team's productivity.

启动

/usr/local/webserver/mysql/bin/mysqld_safe --defaults-file=/etc/my.cnf --user=mysql --basedir=/usr/local/webserver/mysql/ --datadir=/home/mysqldata  &

正常启动。ps -ef | grep mysql 也有相应的进程存在

尝试如下4种方式登录:

# /usr/local/webserver/mysql/bin/mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

# /usr/local/webserver/mysql/bin/mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

# /usr/local/webserver/mysql/bin/mysql -S /tmp/mysql.sock
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

]# /usr/local/webserver/mysql/bin/mysql -u root -S /tmp/mysql.sock
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

而my.cnf中指定的socket就是/tmp/mysql.sock 这个路径

或者如下这种报错:

# /usr/local/webserver/mysql/bin/mysql

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

# /usr/local/webserver/mysql/bin/mysql -u root

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

# /usr/local/webserver/mysql/bin/mysql -S /tmp/mysql.sock

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

#/usr/local/webserver/mysql/bin/mysql -u root -S /tmp/mysql.sock

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


原因是:进行了多次初始化,但是每次初始化的时候没有删除datadir下生成的文件导致的!

切记,每次初始化操作都要删除datadir下生产的文件哦!




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





相关实践学习
基于CentOS快速搭建LAMP环境
本教程介绍如何搭建LAMP环境,其中LAMP分别代表Linux、Apache、MySQL和PHP。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助     相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
相关文章
|
2天前
|
关系型数据库 MySQL 数据库
MySQL 启动 登录报错Job for mysqld.service failed because the control process exited with error code. See
MySQL 启动 登录报错Job for mysqld.service failed because the control process exited with error code. See
|
2天前
|
SQL DataWorks 关系型数据库
DataWorks操作报错合集之DataWorks在同步mysql时报错Code:[Framework-02],mysql里面有个json类型字段,是什么原因导致的
DataWorks是阿里云提供的一站式大数据开发与治理平台,支持数据集成、数据开发、数据服务、数据质量管理、数据安全管理等全流程数据处理。在使用DataWorks过程中,可能会遇到各种操作报错。以下是一些常见的报错情况及其可能的原因和解决方法。
30 0
|
2天前
|
分布式计算 DataWorks 关系型数据库
DataWorks操作报错合集之DataWorks集成实例绑定到同一个vpc下面,也添加了RDS的IP白名单报错:数据源配置有误,请检查,该怎么处理
DataWorks是阿里云提供的一站式大数据开发与治理平台,支持数据集成、数据开发、数据服务、数据质量管理、数据安全管理等全流程数据处理。在使用DataWorks过程中,可能会遇到各种操作报错。以下是一些常见的报错情况及其可能的原因和解决方法。
28 0
|
2天前
|
关系型数据库 MySQL 数据库
MySQL8报错:Public Key Retrieval is not allowed
MySQL8报错:Public Key Retrieval is not allowed
|
2天前
|
关系型数据库 MySQL Java
datagrip连接mysql报错: No appropriate protocol (protocol is disabled or cipher suites are inappropriate
datagrip连接mysql报错: No appropriate protocol (protocol is disabled or cipher suites are inappropriate
|
2天前
|
DataWorks NoSQL 关系型数据库
DataWorks操作报错合集之在使用 DataWorks 进行 MongoDB 同步时遇到了连通性测试失败,实例配置和 MongoDB 白名单配置均正确,且同 VPC 下 MySQL 可以成功连接并同步,但 MongoDB 却无法完成同样的操作如何解决
DataWorks是阿里云提供的一站式大数据开发与治理平台,支持数据集成、数据开发、数据服务、数据质量管理、数据安全管理等全流程数据处理。在使用DataWorks过程中,可能会遇到各种操作报错。以下是一些常见的报错情况及其可能的原因和解决方法。
33 1
|
2天前
|
NoSQL 关系型数据库 Redis
数据管理DMS产品使用合集之要通过 DMS 登录到 RDS、DRDS 或 Redis,我该怎么操作
阿里云数据管理DMS提供了全面的数据管理、数据库运维、数据安全、数据迁移与同步等功能,助力企业高效、安全地进行数据库管理和运维工作。以下是DMS产品使用合集的详细介绍。
|
2天前
|
安全 关系型数据库 MySQL
node实战——后端koa结合jwt连接mysql实现权限登录(node后端就业储备知识)
node实战——后端koa结合jwt连接mysql实现权限登录(node后端就业储备知识)
26 3
|
2天前
|
关系型数据库 MySQL Java
报错 create connection SQLException, url: jdbc:mysql://noreggie?serverTimezone=Asia/Shanghai&useUnicod
报错 create connection SQLException, url: jdbc:mysql://noreggie?serverTimezone=Asia/Shanghai&useUnicod
|
2天前
|
Oracle 关系型数据库 MySQL
Navicate连接Mysql报错2003 Cant connect to MySQL server on (10038)
Navicate连接Mysql报错2003 Cant connect to MySQL server on (10038)
25 0

推荐镜像

更多