如何从linux终端登录mysql并查询数据库 [英] how to log in to mysql and query the database from linux terminal
问题描述
我使用的是 debian linux.我有一台安装了 mysql 的 linux 机器.我可以使用 root 用户和其他用户登录我的 linux 机器.我可以使用sqlyog从windows机器连接到linux机器上的mysql数据库.现在我只想使用 linux 终端在 linux 机器上执行查询
我在终端上尝试了以下一些东西
我去根目录然后我去/var/lib目录
我在终端上运行以下命令
mysqladmin -u root -pmysqladmin -u root -ppassword
每次我收到以下错误消息
<块引用>错误 1045 (28000) 拒绝访问用户 'root'@'localhost'(使用密码否)
请指导我跟随
- 如何在 linux 终端中获得 mysql 提示?
- 如何从 linux 终端停止 mysql 服务器?
- 如何从 linux 终端启动 mysql 服务器?
- 如何在 linux 终端中获得 mysql 提示?
- 如何从 linux 终端登录到 mysql 服务器?
- 如何解决以下错误?
<块引用>
错误 1045 (28000) 拒绝访问用户 'root'@'localhost'(使用密码否)
请给我以上问题的解决方案.谢谢
1.- 如何在 linux 终端获得 mysql 提示?
mysql -u root -p
在Enter password:
提示下,输入root 的密码:)
您可以通过键入 mysql --help
或在 在线手册.
2.如何从 linux 终端停止 mysql 服务器?
这取决于.基于 Red Hat 的发行版具有 service
命令:
服务mysqld停止
其他发行版需要直接调用init脚本:
/etc/init.d/mysqld 停止
3.我如何从 linux 终端启动 mysql 服务器?
与#2 相同,但带有 start
.
4.linux终端如何获取mysql提示?
与#1 相同.
5.如何从linux终端登录mysql服务器?
与#1 相同.
6.如何解决以下错误?
与#1 相同.
I am using debian linux. I have a linux machine on which mysql is install. I can log in to my linux machine using root user as well as other user. I can connect to mysql database on linux machine from windows machine using sqlyog. Now I want to execute queries on linux machine only using linux terminal
I tried some following things on terminal
I went to root directory then I went to /var/lib directory
I run following commands on terminal
mysqladmin -u root -p
mysqladmin -u root -ppassword
everytime I have get following error message
ERROR 1045 (28000) Access denied for user 'root'@'localhost' (Using password NO)
please guide me for following
- How do I get mysql prompt in linux terminal?
- How I stop the mysql server from linux terminal?
- How I start the mysql server from linux terminal?
- How do I get mysql prompt in linux terminal?
- How do I login to mysql server from linux terminal?
- How do I solve following error?
ERROR 1045 (28000) Access denied for user 'root'@'localhost' (Using password NO)
Please give me solutions for above question. Thank You
1.- How do I get mysql prompt in linux terminal?
mysql -u root -p
At the Enter password:
prompt, well, enter root's password :)
You can find further reference by typing mysql --help
or at the online manual.
2. How I stop the mysql server from linux terminal?
It depends. Red Hat based distros have the service
command:
service mysqld stop
Other distros require to call the init script directly:
/etc/init.d/mysqld stop
3. How I start the mysql server from linux terminal?
Same as #2, but with start
.
4. How do I get mysql prompt in linux terminal?
Same as #1.
5. How do I login to mysql server from linux terminal?
Same as #1.
6. How do I solve following error?
Same as #1.
这篇关于如何从linux终端登录mysql并查询数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!