# rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpmmysql
[root@test]# yum install mysqlsql
[root@test]# yum install mysql-server數據庫
[root@test]# yum install mysql-develsocket
[root@test /]# /etc/init.d/mysqld restart 重啓一下數據庫,會自動進行初始化。this
[root@test /]# cat /var/log/mysqld.log | grep "temporary password" 查看密碼.net
2016-06-03T11:22:35.841809Z 1 [Note] A temporary password is generated for root@localhost: 8!Q%r!3:6zs(rest
[root@test /]# mysql -uroot -p //輸入密碼code
mysql> update mysql.user set authentication_string=password('123qwe') where user='root' and Host = 'localhost'; //更新密碼server
===========================================================get
安裝完mysql 以後,登錄之後,無論運行任何命令,老是提示這個
You must reset your password using ALTER USER statement before executing this statement.
step 1: SET PASSWORD = PASSWORD('your new password');
step 2: ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER;
step 3: flush privileges;
============================================================
mysql> update mysql.user set host = '%' where user ='root'; //設置意IP能夠訪問
mysql> flush privileges;
mysql> show databases; ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '********'
配置文件目錄: /etc/my.cnf
set GLOBAL max_connections=300
升級到最新的mysql
yum -y upgrade mysql
CentOS Linux更改MySQL5.7數據庫目錄位置
cp -a mysql /data/mysql/ 參數a表示權限一致
datadir=/data/mysql
socket=/data/mysql/mysql.sock