Home > Database > Mysql Tutorial > body text

mysql学习_MySQL

WBOY
Release: 2016-06-01 13:14:02
Original
923 people have browsed it

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

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

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

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

pgrep mysqld
Copy after login

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

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

datadir = /var/lib/mysql
Copy after login

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

进入MySQL

mysql -u root -p
Copy after login

(输入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>
Copy after login

修改 MySQL 的管理员密码:

sudo mysqladmin -u root password newpassword;
Copy after login
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!