mysql初始化登录报错解决-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下生产的文件哦!

时间: 2024-08-13 02:38:22

mysql初始化登录报错解决-1的相关文章

Mysql远程登录报错:Host '192.168.1.3' is not allowed to connect to this MySQL server

你要访问的MySQL服务器设置了访问权限:如果那个服务器是你自己搭建的解决办法如下,但如果不是你的请管理员帮你添加权限 解决办法1: # 1. 改表 # 登录数据库:mysql -u root -p mysql>use mysql; mysql>update user set host = '%' where user = 'root'; mysql>FLUSH PRIVILEGES; 2. 授权法. (1)例如,你想myuser使用mypassword从任何主机连接到mysql服务器的

hive中创建子表并插入数据过程初始化MR报错解决方法

本文继成上一篇通过hive分析nginx日志文章,详情参考下面链接: http://www.cnblogs.com/wcwen1990/p/7066230.html 接着来: 创建业务子表: drop table if exists chavin.nginx_access_log_comm; create table if not exists chavin.nginx_access_log_comm( host STRING, time STRING, request STRING, refe

mysql update in 报错解决

在用到mysql  update in的时候报错 update area set status='ON' where id in(select id from area where status='ON' and name like '%市辖%') [SQL]update area set status='ON' where id in(select id from area where status='ON' and name like '%市辖%') [Err] 1093 - You can

MySQL MRG_MyISAM 引擎报错解决

报错: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist 因此当遇到Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist报错的时候需要从如下几个方面入手: 1.查看是不是有一些表不是MYISAM引擎的表,

mysql创建登录报错ERROR1045(28000)

最近,创建了一个用户.但是登录时出现错误提示: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) 网上查找了一下:发现了出现问题的原因.数据库安装时,会创建有一个user为空的匿名用户:而这user为空它可以匹配任何字符.如下图(第四个): 而本人创建的用户为: Mysql> grant  all  on  itcase.*  to  'test'@'%'  identified

[转]kilo版openstack的dashboard在session超时后重新登录报错解决办法

http://blog.csdn.net/wylfengyujiancheng/article/details/50523373?locationNum=1&fps=1 1.现象描述: kilo版本的openstack在正常登陆后长时间不做任何操作,dashboard会超时,重新登录会报如下错误: 2.原因: python-django的版本太高,需要降到1.8以下 3.解决办法: a.卸载django的rpm包 # rpm -aq | grep python-django-1. | xargs

Kettle使用MySQL作为资源库报错解决方法

使用Kettle5.0.1,安装的是MySQL5.1.JDK1.6,在\data-integration\lib目录里添加mysql的JDBC包mysql-connector-java-5.0.8-bin.jar, 在新建资源库里设置好MySQL的各种信息,如下 点“测试”报如下错误 错误连接数据库 [本地MySQL的[test]数据库] : org.pentaho.di.core.exception.KettleDatabaseException: Error occured while tr

友盟登录微信第三方登录报错解决linker command failed with exit code 1

:错误 Undefined symbols for architecture x86_64: "OBJC_CLASS$_UMSocialUtils", referenced from: objc-class-ref in libSocialWechat.a(UMSocialWechatHandler.o) ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with ex

window下用主机名登录MySQL数据库出现报错解决方案

分享一个工作中的小案例:windows主机上用SQLyog使用主机名登录MySQL数据库(Linux系统上搭建),结果报错,因为经常在windows上使用主机名互相访问资源.远程登录等.以为Linux上应该也可以,所以就开始研究.通过查找资料及多方帮助终于解决并搞清楚原因.希望大家不要重蹈覆辙. 故障:在windows服务器上使用主机名登录MySQL出现以下报错,主机名"test-aa-shop1" ping不通,但是对应的IP可以ping通. 故障分析:windows之间可以用主机名