yum install mysql yum install mysql-server yum install mysql-devel
service mysqld restart
mysql -u root
mysql> show databases;
mysql> set password for 'root'@'localhost' =password('password');
yum install php-mysql;
yum install mbstring;
yum -y remove mariadb-libs yum install mysql-community-server
[mysql] default-character-set =utf8
mysql> grant all privileges on *.* to root@'%'identified by 'password';
mysql>create user 'username'@'%' identified by 'password';
mysql> show variables like 'port';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
SHOW VARIABLES LIKE 'validate_password%';
set global validate_password_policy=LOW;
set global validate_password_length=6;
ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
[mysql] default-character-set =utf8
mysql> grant all privileges on *.* to root@'%'identified by 'password';
mysql>create user 'username'@'%' identified by 'password';
ALTER USER 'root'@'localhost' IDENTIFIED BY '@abcd123456';
set password=password("yourpassword");
mysql -u root -p
show databases;
use mysql;
show tables;
select Host, User, from user;
update user set Host='%' where User='root';
说明: % 代表任意的客户端,可替换成具体IP地址。
flush privileges;
grant all privileges on 数据库名.表名 to 创建的用户名(root)@"%" identified by "密码";
flush privileges;
#刷新刚才的内容
grant all privileges on *.* to root@"113.123.123.1" identified by "123456789";
@ 后面是访问mysql的客户端IP地址(或是 主机名) % 代表任意的客户端,如果填写 localhost 为本地访问(那此用户就不能远程访问该mysql数据库了)
mysql_secure_installation
systemctl stop mysqld
systemctl restart mysqld
systemctl status mysqld
systemctl enable mysqld
systemctl disable mysqld
vi /etc/my.cnf
添加
[mysqld] character_set_server=utf8 init_connect='SET NAMES utf8'