mysql相关命令
Posted 码农
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mysql相关命令相关的知识,希望对你有一定的参考价值。
1.检查mysql服务器是否启动
ps -ef | grep mysqld
如何显示如下,证明已经启动
localhost:~ mhx$ ps -ef | grep mysqld
0 1053 1 0 9:59上午 ttys000 0:00.03 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/usr/local/mysql/data --pid-file=/usr/local/mysql/data/localhost.pid
74 1171 1053 0 9:59上午 ttys000 0:00.48 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/usr/local/mysql/data/localhost.err --pid-file=/usr/local/mysql/data/localhost.pid
501 1242 1235 0 10:07上午 ttys001 0:00.00 grep mysqld
2.启动mysql服务器
localhost:~ mhx$ cd /usr/local/mysql/support-files/
localhost:support-files mhx$ sudo ./mysql.server start
3.登陆数据
localhost:support-files mhx$ cd /usr/local/mysql/bin/
localhost:bin mhx$ ./mysql -u root -p
3.查看数据库
mysql> show databases;
以上是关于mysql相关命令的主要内容,如果未能解决你的问题,请参考以下文章