[关闭]
@WillireamAngel 2018-03-09T06:26:01.000000Z 字数 911 阅读 1389

MySQL菜鸟教程

数据库


MySQL预备知识

PHP+HTML基本语法

MySQL安装

  1. CentOS安装基本命令
    参考文章:http://www.linuxidc.com/Linux/2016-09/135288.htm
  1. wget http://dev.mysql.com/get/mysql57-community-release-el7-20.noarch.rpm
  2. yum localinstall mysql57-community-release-el7-20.noarch.rpm
  3. yum repolist enabled | grep "mysql.*-community.*" #验证安装是否成功
  4. yum install mysql-community-server #安装MySQL
  5. systemctl start mysqld #启动MySQL服务
  6. systemctl status mysqld #查看MySQL启动状态
  7. shell> systemctl enable mysqld
  8. shell> systemctl daemon-reload #开机启动
  9. shell> grep 'temporary password' /var/log/mysqld.log
  10. shell> mysql -uroot -p
  11. mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';
  12. 或者
  13. mysql> set password for 'root'@'localhost'=password('MyNewPass4!'); ##修改root密码
  1. MySQL登录
  1. mysql

设置密码:

  1. mysqladmin -u root password "new_password";

重新登录:

  1. [root@host]# mysql -u root -p
  2. Enter password:*******

MySQL管理

  1. 启动关闭mysql
    查看状态:
  1. systemctl status mysqld

or

  1. ps -ef | grep mysqld

启动与关闭mysql:
启动:

  1. cd /usr/bin
  2. ./mysqld_safe &

or

  1. systemctl start mysqld
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注