MySQL教程--整理

2020-04-18  本文已影响0人  Then丶
rpm -qa | grep mysql
wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
rpm -ivh mysql-community-release-el7-5.noarch.rpm
yum update
yum install mysql-server
chown mysql:mysql -R /var/lib/mysql
mysqld --initialize
systemctl start mysqld
systemctl status mysqld
mysqladmin --version
mysqladmin -u root password "new_password";
CREATE USER ‘Kevin'@'localhost' IDENTIFIED BY ‘123456';
SELECT host, user, password FROM mysql.user WHERE user='Kevin';
GRANT<privileges>ON <database>.<table> TO 'Kevin'@'localhost';
ex: GRANT CREATE, INSERT ON  *.* TO 'Kevin'@'localhost';
SHOW GRANTS FOR 'Kevin'@'localhost';
REVOKE <privileges> ON <database>.<table> FROM 'Kevin'@'localhost';
FLUSH PRIVILEGES;

ps -ef | grep mysqld
root@host# cd /usr/bin
./mysqld_safe &
root@host# cd /usr/bin
./mysqladmin -u root -p shutdown
CREATE DATABASE IF NOT EXISTS RUNOOB DEFAULT CHARSET utf8 COLLATE utf8_general_ci;

创建数据库,该命令的作用:

  1. 如果数据库不存在则创建,存在则不创建。
  2. 创建RUNOOB数据库,并设定编码集为utf8
上一篇 下一篇

猜你喜欢

热点阅读