# Copyright (c) 2014,2016,Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not,write to the Free Software
# Foundation,Inc.,51 Franklin St,Fifth Floor,Boston,MA 02110-1301 USA
#
# The MySQL Server configuration file.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
# Here is entries for some specific programs
# The following values assume you have at least 32M ram
# This was formally known as [safe_mysqld]. Both versions are currently parsed.
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
[mysqld]
character-set-server=utf8
lower_case_table_names=1
#
# * Basic Settings
#
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
#datadir = /var/lib/mysql
datadir = /mnt/mysql/
tmpdir = /var/tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
#
# * Fine Tuning
#
key_buffer = 16M
max_allowed_packet = 16M
thread_stack = 192K
thread_cache_size = 8
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover = BACKUP
#max_connections = 100
#table_cache = 64
#thread_concurrency = 10
#
# * Query Cache Configuration
#
query_cache_limit = 1M
query_cache_size = 16M
#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
#general_log_file = /var/log/mysql/mysql.log
#general_log = 1
#
# Error log - should be very few entries.
#
#log_error = /var/log/mysql/error.log
log_error = /mnt/log/mysql/error.log
#
# Here you can see queries with especially long duration
#log_slow_queries = /var/log/mysql/mysql-slow.log
#long_query_time = 2
#log-queries-not-using-indexes
#
# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave,see README.Debian about
# other settings you may need to change.
#server-id = 1
#log_bin = /var/log/mysql/mysql-bin.log
log_bin = /mnt/log/mysql/mysql-bin.log
binlog_format = "MIXED"
#expire_logs_days = 3
max_binlog_size = 100M
#binlog_do_db = include_database_name
#binlog_ignore_db = include_database_name
#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
#
# * Security Features
#
# Read the manual,too,if you want chroot!
# chroot = /var/lib/mysql/
#
# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
#
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem
[mysqldump]
quick
quote-names
max_allowed_packet = 16M
[mysql]
default-character-set=utf8
#no-auto-rehash # faster start of mysql but no tab completition
[isamchk]
key_buffer = 16M
#
# * IMPORTANT: Additional settings that can override those from this file!
# The files must end with '.cnf',otherwise they'll be ignored.
#
!includedir /etc/mysql/conf.d/
[mysqld]
wait_timeout=31536000
interactive_timeout=31536000
如果之前安装过mysql,请执行如下操作
-----------------------------------------------------------------
UBUNTU 彻底删除 MYSQL 然后重装 MYSQL
删除 mysql
sudo apt-get autoremove --purge mysql-server-5.0
sudo apt-get remove mysql-server
sudo apt-get autoremove mysql-server
sudo apt-get remove mysql-common //这个很重要
上面的其实有一些是多余的。
清理残留数据
dpkg -l |grep ^rc|awk '{print $2}' |sudo xargs dpkg -P
----------------------------------------------------------------------------
这里是正常的开始安装步骤:
1.在官网下载mysql安装包
2.将包上传至服务器,并将该文件解压
解压命令为:
tar –xvf mysql-server_5.6.28-1ubuntu14.04_amd64.deb-bundle.tar
解压后得到一系列的.deb文件。依次为:
libmysqlclient18_5.6.28-1ubuntu14.04_amd64.deb
libmysqlclient-dev_5.6.28-1ubuntu14.04_amd64.deb
libmysqld-dev_5.6.28-1ubuntu14.04_amd64.deb
mysql-client_5.6.28-1ubuntu14.04_amd64.deb
mysql-common_5.6.28-1ubuntu14.04_amd64.deb
mysql-community-bench_5.6.28-1ubuntu14.04_amd64.deb
mysql-community-client_5.6.28-1ubuntu14.04_amd64.deb
mysql-community-server_5.6.28-1ubuntu14.04_amd64.deb
mysql-community-source_5.6.28-1ubuntu14.04_amd64.deb
mysql-community-test_5.6.28-1ubuntu14.04_amd64.deb
mysql-server_5.6.28-1ubuntu14.04_amd64.deb
mysql-testsuite_5.6.28-1ubuntu14.04_amd64.deb
3.安装文件
这里这些文件存在着依赖关系,如果一个一个安装,要安装顺序来安装:
sudo dpkg -i mysql-common_5.6.28-1ubuntu14.04_amd64.deb
sudo dpkg -i libmysqlclient18_5.6.28-1ubuntu14.04_amd64.deb
sudo dpkg -i libmysqlclient-dev_5.6.28-1ubuntu14.04_amd64.deb
sudo dpkg -i libmysqld-dev_5.6.28-1ubuntu14.04_amd64.deb
sudo dpkg -i mysql-community-server_5.6.28-1ubuntu14.04_amd64.deb注意在安装mysql-community-server会要求输入root账户密码
sudo dpkg -i mysql-server_5.6.28-1ubuntu14.04_amd64.deb
到这里个人认为服务器应该可以使用了(未测试),但是mysql命令还不能使用
sudo dpkg -i mysql-community-client_5.6.28-1ubuntu14.04_amd64.deb
sudo dpkg -i mysql-client_5.6.28-1ubuntu14.04_amd64.deb到这里,mysql的安装完成
还有几个文件没有用,用处现在不知道
mysql-community-bench_5.6.28-1ubuntu14.04_amd64.deb
mysql-community-source_5.6.28-1ubuntu14.04_amd64.deb
mysql-community-test_5.6.28-1ubuntu14.04_amd64.deb
mysql-testsuite_5.6.28-1ubuntu14.04_amd64.deb
安装过程中可能会提示缺少依赖包,这里安装依赖包就好 比如:
这里安装一下 libmecab2 可能会在这出现输入数据库的密码界面
4.启动和停止mysql服务命令
/etc/init.d/mysql start
/etc/init.d/mysql stopmysql的root账户,我在连接时通常用的是localhost或127.0.0.1,公司的测试服务器上的mysql也是localhost所以我想访问无法访问,测试暂停. 解决方法如下: 1,修改表,登录mysql数据库,切换到mysql数据库,使用sql语句查看"select host,user from user ;" mysql -u root -pvmwaremysql>use mysql; mysql>update user set host = '%' where user ='root'; mysql>select host,user from user; mysql>flush privileges; 注意:最后一句很重要,目的是使修改生效.如果没有写,则还是不能进行远程连接. 2,授权用户,你想root使用密码从任何主机连接到mysql服务器
GRANT ALL PRIVILEGES ON *.* TO'root'@'%' IDENTIFIED BY 'admin123' WITH GRANT OPTION; flush privileges;
如果你想允许用户root从ip为192.168.1.104的主机连接到mysql服务器
GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'192.168.1.104' IDENTIFIED BY 'admin123' WITH GRANT OPTION; flush privileges;
我装的版本是2.7.16 打开配置文件my.cnf 里面跟以前不一样了 好像是指向其他文件:!includedir /etc/mysql/conf.d/ !includedir /etc/mysql/mysql.conf.d/网上找了下说是在/etc/mysql/mysql.conf.d里面,果然在路径/etc/mysql/mysql.conf.d/mysqld.cnf是真实的配置文件路径mysqld.cnf配置如下:
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。