最近安装一个高版本的MYSQL,与以前的版本小异,网上的有些文章不知云里雾里,看官网文档是最好的,特做记录。
yum install mysql-community-server
Index of /232905/yum
Name Last modified Size
Parent Directory 21-Sep-2017 15:22 1k
mysql-5.5-community/ 21-Sep-2017 08:02 1k
mysql-5.6-community/ 21-Sep-2017 08:04 1k
mysql-5.7-community/ 21-Sep-2017 08:04 1k
mysql-8.0-community/ 21-Sep-2017 15:22 1k
mysql-cluster-7.5-community/ 21-Sep-2017 08:01 1k
mysql-cluster-7.6-community/ 21-Sep-2017 08:03 1k
mysql-community/ 21-Sep-2017 08:02 1k
mysql-connectors-community/ 21-Sep-2017 08:02 1k
mysql-tools-community/ 21-Sep-2017 08:04 1k
mysql-tools-preview/ 21-Sep-2017 03:38 1k
Installing:
mysql-community-libs x86_64 5.7.19-1.el7 mysql57-community 2.1 M
replacing mariadb-libs.x86_64 1:5.5.44-2.el7.centos
mysql-community-libs-compat x86_64 5.7.19-1.el7 mysql57-community 2.0 M
replacing mariadb-libs.x86_64 1:5.5.44-2.el7.centos
mysql-community-server x86_64 5.7.19-1.el7 mysql57-community 164 M
Installing for dependencies:
mysql-community-client x86_64 5.7.19-1.el7 mysql57-community 24 M
mysql-community-common x86_64 5.7.19-1.el7 mysql57-community 272 k
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
datadir=/data/mysql
socket=/var/lib/mysql/mysql.sock
symbolic-links=0
pid-file=/var/run/mysqld/mysqld.pid
socket=/var/lib/mysql/mysql.sock
[root@localhost run]# ls -al | grep mysql
drwxr-xr-x. 2 mysql mysql 40 Dec 28 10:09 mysqld
[root@localhost run]#
total 110596
drwxr-xr-x. 2 mysql mysql 77 Dec 28 10:48 .
drwxr-xr-x. 3 root root 18 Dec 28 10:32 ..
-rw-r-----. 1 mysql mysql 215 Dec 28 10:48 ib_buffer_pool
-rw-r-----. 1 mysql mysql 12582912 Dec 28 10:48 ibdata1
-rw-r-----. 1 mysql mysql 50331648 Dec 28 10:48 ib_logfile0
-rw-r-----. 1 mysql mysql 50331648 Dec 28 10:48 ib_logfile1
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 5.7.17 MySQL Community Server (GPL)
affiliates. Other names may be trademarks of their respective
owners.
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
mysql> desc user;
+------------------------+-----------------------------------+------+-----+-----------------------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------------------+-----------------------------------+------+-----+-----------------------+-------+
| Host | char(60) | NO | PRI | | |
| User | char(32) | NO | PRI | | |
| Select_priv | enum('N','Y') | NO | | N | |
| Insert_priv | enum('N','Y') | NO | | N | |
| Update_priv | enum('N','Y') | NO | | N | |
| Delete_priv | enum('N','Y') | NO | | N | |
| Create_priv | enum('N','Y') | NO | | N | |
| Drop_priv | enum('N','Y') | NO | | N | |
| Reload_priv | enum('N','Y') | NO | | N | |
| Shutdown_priv | enum('N','Y') | NO | | N | |
| Process_priv | enum('N','Y') | NO | | N | |
| File_priv | enum('N','Y') | NO | | N | |
| Grant_priv | enum('N','Y') | NO | | N | |
| References_priv | enum('N','Y') | NO | | N | |
| Index_priv | enum('N','Y') | NO | | N | |
| Alter_priv | enum('N','Y') | NO | | N | |
| Show_db_priv | enum('N','Y') | NO | | N | |
| Super_priv | enum('N','Y') | NO | | N | |
| Create_tmp_table_priv | enum('N','Y') | NO | | N | |
| Lock_tables_priv | enum('N','Y') | NO | | N | |
| Execute_priv | enum('N','Y') | NO | | N | |
| Repl_slave_priv | enum('N','Y') | NO | | N | |
| Repl_client_priv | enum('N','Y') | NO | | N | |
| Create_view_priv | enum('N','Y') | NO | | N | |
| Show_view_priv | enum('N','Y') | NO | | N | |
| Create_routine_priv | enum('N','Y') | NO | | N | |
| Alter_routine_priv | enum('N','Y') | NO | | N | |
| Create_user_priv | enum('N','Y') | NO | | N | |
| Event_priv | enum('N','Y') | NO | | N | |
| Trigger_priv | enum('N','Y') | NO | | N | |
| Create_tablespace_priv | enum('N','Y') | NO | | N | |
| ssl_type | enum('','ANY','X509','SPECIFIED') | NO | | | |
| ssl_cipher | blob | NO | | NULL | |
| x509_issuer | blob | NO | | NULL | |
| x509_subject | blob | NO | | NULL | |
| max_questions | int(11) unsigned | NO | | 0 | |
| max_updates | int(11) unsigned | NO | | 0 | |
| max_connections | int(11) unsigned | NO | | 0 | |
| max_user_connections | int(11) unsigned | NO | | 0 | |
| plugin | char(64) | NO | | mysql_native_password | |
| authentication_string | text | YES | | NULL | |
| password_expired | enum('N','Y') | NO | | N | |
| password_last_changed | timestamp | YES | | NULL | |
| password_lifetime | smallint(5) unsigned | YES | | NULL | |
| account_locked | enum('N','Y') | NO | | N | |
+------------------------+-----------------------------------+------+-----+-----------------------+-------+
45 rows in set (0.01 sec)
+-----------+-----------+
| Host | User |
+-----------+-----------+
| localhost | mysql.sys |
| localhost | root |
+-----------+-----------+
2 rows in set (0.00 sec)
tcp6 0 0 :::3306 :::* LISTEN 24088/mysqld
systemctl disable firewalld.service
systemctl disable iptables.service
1.可能是/usr/local/mysql/data/rekfan.pid文件没有写的权限
解决方法 :给予权限,执行 “chown -R mysql:mysql /var/data” “chmod -R 755 /usr/local/mysql/data” 然后重新启动mysqld!
2.可能进程里已经存在mysql进程
解决方法:用命令“ps -ef|grep mysqld”查看是否有mysqld进程,如果有使用“kill -9 进程号”杀死,然后重新启动mysqld!
3.可能是第二次在机器上安装mysql,有残余数据影响了服务的启动。
解决方法:去mysql的数据目录/data看看,如果存在mysql-bin.index,就赶快把它删除掉吧,它就是罪魁祸首了。本人就是使用第三条方法解决的 !http://blog.rekfan.com/?p=186
4.mysql在启动时没有指定配置文件时会使用/etc/my.cnf配置文件,请打开这个文件查看在[mysqld]节下有没有指定数据目录(datadir)。
解决方法:请在[mysqld]下设置这一行:datadir = /usr/local/mysql/data
5.skip-federated字段问题
解决方法:检查一下/etc/my.cnf文件中有没有没被注释掉的skip-federated字段,如果有就立即注释掉吧。
6.错误日志目录不存在
解决方法:使用“chown” “chmod”命令赋予mysql所有者及权限
7.selinux惹的祸,如果是centos系统,默认会开启selinux
解决方法:关闭它,打开/etc/selinux/config,把SELINUX=enforcing改为SELINUX=disabled后存盘退出重启机器试试。