search
HomeDatabaseMysql TutorialMySQL登陆问题总结_MySQL

bitsCN.com MySQL登陆问题总结 想在自己的小本上练习一下MySQL,结果登陆就有问题,折腾了半个小时终于搞定,也把这几个常见的问题总结下来和大家分享。笔者的系统是OpenSuSE,其他系统的解决方式类似,供大家参考。 首先,登陆MySQL,提示ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (2),ps后感觉mysqld是启动的呀 [plain]  atom@openSuSE:~> mysql -u root -h localhost -p  Enter password:      ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (2)  atom@openSuSE:~> ps aux | grep mysql  atom      1842  0.0  1.0 265564 41296 ?        Sl   09:15   0:00 /usr/sbin/mysqld --defaults-file=/home/atom/.local/share/akonadi//mysql.conf --datadir=/home/atom/.local/share/akonadi/db_data/ --socket=/home/atom/.local/share/akonadi/socket-openSuSE.site/mysql.socket  atom      2788  0.0  0.0   8276   876 pts/0    S+   09:25   0:00 grep --color=auto mysql  
 但是,查看mysqld的状态,发现Active: inactive (dead)。。。[plain]  atom@openSuSE:~> /etc/init.d/mysql status  redirecting to systemctl  mysql.service - LSB: Start the MySQL database server  Loaded: loaded (/etc/init.d/mysql)  Active: inactive (dead)  CGroup: name=systemd:/system/mysql.service  那就再启动一次,观察mysql的状态。
 [plain]  atom@openSuSE:~> sudo /etc/init.d/mysql restart  redirecting to systemctl      atom@openSuSE:~> ps aux | grep mysql  atom      1842  0.0  1.0 265564 41296 ?        Sl   09:15   0:00 /usr/sbin/mysqld --defaults-file=/home/atom/.local/share/akonadi//mysql.conf --datadir=/home/atom/.local/share/akonadi/db_data/ --socket=/home/atom/.local/share/akonadi/socket-openSuSE.site/mysql.socket  root     22000  0.0  0.0  11536  1644 ?        S    09:32   0:00 /bin/sh /usr/bin/mysqld_safe --mysqld=mysqld --user=mysql --pid-file=/var/run/mysql/mysqld.pid --socket=/var/run/mysql/mysql.sock --datadir=/var/lib/mysql  mysql    22322  0.2  1.0 721584 42540 ?        Sl   09:32   0:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/log/mysql/mysqld.log --pid-file=/var/run/mysql/mysqld.pid --socket=/var/run/mysql/mysql.sock --port=3306  atom     22359  0.0  0.0   8276   872 pts/0    S+   09:33   0:00 grep --color=auto mysql  atom@openSuSE:~> /etc/init.d/mysql status  redirecting to systemctl  mysql.service - LSB: Start the MySQL database server  Loaded: loaded (/etc/init.d/mysql)      Active: active (running) since Mon, 18 Jun 2012 09:32:43 +0800; 3min 32s ago  Process: 21865 ExecStart=/etc/init.d/mysql start (code=exited, status=0/SUCCESS)  CGroup: name=systemd:/system/mysql.service  ├ 22000 /bin/sh /usr/bin/mysqld_safe --mysqld=mysqld --user=mysql --pid-file=/var/run/mysql/mysqld.pid --socket=...  └ 22322 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mys...  
 这下总算正常了,再尝试登陆又给出错误提示:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)。在网上查到一种解决方案,供大家参考。首先,关闭mysqld服务,然后执行下面两条命令,总算可以进去了,先改密码~[plain]  atom@openSuSE:~> sudo /etc/init.d/mysql stop  root's password:      redirecting to systemctl  atom@openSuSE:~> sudo mysqld_safe --user=mysql --skip-grant-tables --skip-networking &  [1] 22638  atom@openSuSE:~> 120618 09:40:32 mysqld_safe Logging to '/var/log/mysql/mysqld.log'.  120618 09:40:32 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql    atom@openSuSE:~> mysql -u root mysql  [sql]  mysql> UPDATE user SET Password=PASSWORD('xxxx') where USER='root';  mysql> FLUSH PRIVILEGES;  mysql> quit  把PASSWORD('xxxx')中xxxx替换为你自己的密码。重启一次,使用设置的新密码就可以进去了。
  作者 nevasun bitsCN.com

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
操作系统实现按名存取的关键在于解决什么操作系统实现按名存取的关键在于解决什么Aug 17, 2022 am 11:17 AM

操作系统实现按名存取的关键在于解决文件名称与具体的物理地址的转换;实现逻辑文件到物理文件间的转换,即按名存取外存上的文件,按名存取实现文件的共享和保密,不同用户能在系统的控制下共享其他用户的文件。

los是什么系统los是什么系统Nov 07, 2022 pm 04:31 PM

los就是LineageOS,是一个基于Android面向智能手机以及平板电脑的开放源代码操作系统。los的前身为Cyanogenmod,通常称CM,是全球最大的安卓第三方编译团队,促进了用户的安卓版本的第三方升级,在早期曾经先于谷歌为很多手机定制了稳定版的安卓1.6,此后该团队的联合创始人及核心团队,重组了全新的LineageOS,继续为用户提供免费的第三方系统支持。

SAP系统的五大模块是什么SAP系统的五大模块是什么Sep 29, 2022 am 11:52 AM

SAP五大模块是:1、物料管理模块,主要有采购、库房与库存管理、供应商评价等管理功能;2、工厂维护模块,提供对定期维护、检查与服务管理的规划、控制和处理;3、质量管理模块,可提供质量计划、质量检测、质量控制、质量文档等功能;4、销售与分销模块,包括销售计划、询价报价、订单管理、运输发货、发票等的管理;5、生产计划模块,可实现对工厂数据、生产计划、能力计划、成本核算等的管理。

荣耀手机是什么系统荣耀手机是什么系统Jul 27, 2022 am 10:23 AM

荣耀手机使用的是“Magic UI”、“EMUI”和“HarmonyOS”操作系统;荣耀的新机型采用的都是“Magic UI”系统,旧机型普遍使用的是基于安卓的EMUI系统,而部分机型支持升级为华为研发的HarmonyOS操作系统。

如何查看电脑系统是什么版本如何查看电脑系统是什么版本Jan 02, 2021 pm 03:54 PM

方法:1、在电脑桌面上,右击“计算机”,选择“属性”;2、在“系统”界面的“windows 版本”区域即可查看当前系统版本。2、使用“Win+R”快捷键,打开“运行”窗口,输入“winver”回车,在弹出的对话框中即可查看当前系统版本信息。

funtouch os是什么系统funtouch os是什么系统Aug 22, 2022 am 11:43 AM

“funtouch os”是vivo基于安卓系统开发的智能手机操作系统;“funtouch os”是针对vivo公司中高端手机推出的一款人性化手机操作系统,该系统与2013年10月发布,以用户体验为核心,以简约、乐趣、智慧、理念为设计导向。

三星手机是什么系统三星手机是什么系统Nov 16, 2022 pm 05:22 PM

三星手机是安卓系统,只不过不是原生的安卓系统,而是原生安卓系统经过定制之后的系统,例如OneUI。OneUI是在2018年三星开发者大会上推出的全新基于安卓系统深度定制的用户界面,是三星和google合作进行研发的;可以同时运行在折叠屏产品上和非折叠屏产品上,通过交互的改进让两种不同形态的产品都有相近的操作体验。

ghost的本质是什么ghost的本质是什么Aug 29, 2022 pm 03:27 PM

Ghost的本质是对磁盘或者硬盘进行快速备份与还原;利用Ghost安装Windows系统最大的优点就是速度快而且一键安装,并且Ghost系统大多集成了大多数电脑所需要的驱动程序以及一些常用的应用软件。需要注意:1、通过网络下载到的Ghost系统,其预置的驱动程序与自己的电脑可能不兼容,会导致安装之后出现蓝屏而无法正常使用;2、Ghost系统捆绑安装的应用软件太多。

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!