码迷,mamicode.com
首页 > 数据库 > 详细

二进制安装mysql

时间:2019-05-25 09:54:10      阅读:134      评论:0      收藏:0      [点我收藏+]

标签:eset   file   iptables   ati   tmp   添加   lte   client   root   

如果没有设置密码,配置文件设置grant-skip-tables,只需要生效即可
MariaDB [(none)]> grant all on *.* to ‘test‘@‘192.168.30.%‘identified by ‘123.com‘;
ERROR 1290 (HY000): The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)


utf8修改字符集
[mysqld]
datadir=/usr/local/mysql/data
socket=/tmp/mysql.sock

character-set-server=utf8
[client]
default-character-set=utf8

[mysqld_safe]
log-error=/usr/local/mysql/data/mysql.log
pid-file=/usr/local/mysql/data/mysql.pid

mysql >show variables like ‘character_set_%‘;

ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
报错
解决办法
1、 修改用户密码
mysql> alter user ‘root‘@‘localhost‘ identified by ‘youpassword‘;
2、刷新权限
mysql> flush privileges;

systemctl stop firewalld
systemctl disable firewalld
setenforce 0
iptables -F
yum -y install libaio
tar xf mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz -C /usr/local
cd /usr/local
ln -s mysql-5.7.24-linux-glibc2.12-x86_64/ mysql
useradd -M -s /sbin/nologin mysql
chown -R mysql:mysql ./
cd mysql
[root@bogon mysql]# ./bin/mysqld --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --initialize
把密码记下来
6#tlVZ9HW(tQ
[root@bogon mysql]# vim /etc/my.cnf
[mysqld]
datadir=/usr/local/mysql/data
socket=/tmp/mysql.sock

[mysqld_safe]
log-error=/usr/local/mysql/data/mysql.log
pid-file=/usr/local/mysql/data/mysql.pid

[root@bogon mysql]# ./support-files/mysql.server start
[root@bogon mysql]# netstat -anpt |grep :3306
tcp6       0      0 :::3306                 :::*                    LISTEN      3469/mysqld  
cp support-files/mysql.server /etc/init.d/mysqld
ls -l /etc/init.d/mysqld

ln -s /usr/local/mysql/bin/* /usr/local/bin
service mysqld stop
vim /etc/my.cnf
添加skip-grant-tables
启动服务service mysqld start
mysql -uroot -p
回车
mysql> use mysql;
mysql> update mysql.user set authentication_string=password("123456789") where user=‘root‘;
mysql> flush privileges;
mysql> exit

关闭服务,service mysqld stop
把skip-grant-tables加#注释或删除
 service mysqld start启动服务

mysql -uroot -p进去密码已修改为123456789
如果数据库无法查看库和表说明你的语句有问题
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
报错
解决办法
1、 修改用户密码
mysql> alter user ‘root‘@‘localhost‘ identified by ‘youpassword‘;
2、刷新权限
mysql> flush privileges;

二进制安装mysql

标签:eset   file   iptables   ati   tmp   添加   lte   client   root   

原文地址:https://www.cnblogs.com/zc1741845455/p/10921284.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!