Home  >  Article  >  Database  >  mysql学习_MySQL

mysql学习_MySQL

WBOY
WBOYOriginal
2016-06-01 13:14:02904browse

一旦安装完成,MySQL 服务器应该自动启动。

sudo start mysql #手动的话这样启动
sudo stop mysql #手动停止

当你修改了配置文件后,你需要重启 mysqld 才能使这些修改生效。

要想检查 mysqld 进程是否已经开启,可以使用下面的命令:

pgrep mysqld

如果进程开启,这个命令将会返回该进程的 id。

MySQL配置文件:/etc/mysql/my.cnf ,其中指定了数据文件存放路径

datadir = /var/lib/mysql

如果你创建了一个名为 test 的数据库,那么这个数据库的数据会存放到 /var/lib/mysql/test 目录下。

进入MySQL

mysql -u root -p

(输入mysql的root密码)

qii@ubuntu:~$ mysql -u root -pEnter password: Welcome to the MySQL monitor.Commands end with ; or /g.Your MySQL connection id is 37Server version: 5.1.41-3ubuntu12.3 (Ubuntu)Type 'help;' or '/h' for help. Type '/c' to clear the current input statement.mysql>

修改 MySQL 的管理员密码:

sudo mysqladmin -u root password newpassword;
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