下載mysql 5.7.10安裝包: https://cdn.mysql.com/archives/mysql-5.7/mysql-community-server-5.7.10-1.el6.x86_64.rpmnode
下載https://cdn.mysql.com/archives/mysql-5.7/mysql-community-libs-5.7.10-1.el6.x86_64.rpmmysql
下載https://cdn.mysql.com/archives/mysql-5.7/mysql-community-common-5.7.10-1.el6.x86_64.rpmsql
安裝過程: 安裝mysql:centos
rpm -ivh mysql-community-server-5.7.19-1.el6.x86_64.rpm --force --nodeps
--force --nodeps
是爲了保證因爲沒有key致使安裝失敗的參數socket
安裝libscode
rpm -ivh mysql-community-libs-5.7.10-1.el6.x86_64.rpm
安裝commoncdn
rpm -ivh mysql-community-common-5.7.10-1.el6.x86_64.rpm
/usr/share/mysql/
下的文件[mysqld] datadir=/data/mysql/lib socket=/data/mysql/mysql.sock user=mysql # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 explicit_defaults_for_timestamp=1 default_password_lifetime=0 #skip-grant-tables sql_mode = "STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION" [mysqld_safe] log-error=/data/mysql/log/mysqld.log pid-file=/data/mysql/run/mysqld/mysqld.pid
啓動: service mysqld startserver
在配置中添加skip-grant-tables能夠容許免密登陸,也能夠使用啓動時給的臨時密碼,不過在我這裏臨時密碼一直報過時的問題。ip
登陸後修改root密碼,同時將密碼設置爲不會過時:ci
update mysql.user set authentication_string=password('newPass') where user='root' ; update user set password_expired='N' where user='root'; flush privileges;
配置中也須要添加default_password_lifetime=0
須要遠程登陸root的話要添加root@%的權限
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'newPass' WITH GRANT OPTION; flush privileges;
這就基本能夠進行數據的使用了
在執行select的時候若是有order by子句,可是沒有把全部的列都寫到order by中的話會報1055的錯,解決方法以下:
在/etc/my.cnf配置中增長配置:
sql_mode = "STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
重啓mysql,以後就不會報錯了。