您的位置:首页 > 数据库 > MySQL

mysql5.6.30安装

2016-06-07 11:37 337 查看

mysql5.6.30安装

借鉴同事的安装过程,重写了一个教程。

下载mysql-server_5.6.30-1ubuntu14.04_amd64.deb-bundle.tar并将文件拷贝至linux服务器中

mysql-server_5.6.30-1ubuntu14.04_amd64.deb-bundle.tar的360云盘共享

https://yunpan.cn/cRfxUfGGUUfz8 访问密码 b8a4

在/usr/local目录下创建目录mysql5.6.30

root@localhost:/home/xiaoyao# mkdir /usr/local/mysql5.6.30


拷贝安装文件至/usr/local/mysql5.6.30

root@localhost:/home/xiaoyao# cp mysql-server_5.6.30-1ubuntu14.04_amd64.deb-bundle.tar /usr/local/mysql5.6.30/


解压缩安装文件

root@localhost:/home/xiaoyao# cd /usr/local/mysql5.6.30/
root@localhost:/usr/local/mysql5.6.30# tar -xf mysql-server_5.6.30-1ubuntu14.04_amd64.deb-bundle.tar
root@localhost:/usr/local/mysql5.6.30# ls
libmysqlclient18_5.6.30-1ubuntu14.04_amd64.deb    mysql-community_5.6.30-1ubuntu14.04_amd64.changes     mysql-community-test_5.6.30-1ubuntu14.04_amd64.deb
libmysqlclient-dev_5.6.30-1ubuntu14.04_amd64.deb  mysql-community-bench_5.6.30-1ubuntu14.04_amd64.deb   mysql-server_5.6.30-1ubuntu14.04_amd64.deb
libmysqld-dev_5.6.30-1ubuntu14.04_amd64.deb       mysql-community-client_5.6.30-1ubuntu14.04_amd64.deb  mysql-server_5.6.30-1ubuntu14.04_amd64.deb-bundle.tar
mysql-client_5.6.30-1ubuntu14.04_amd64.deb        mysql-community-server_5.6.30-1ubuntu14.04_amd64.deb  mysql-testsuite_5.6.30-1ubuntu14.04_amd64.deb
mysql-common_5.6.30-1ubuntu14.04_amd64.deb        mysql-community-source_5.6.30-1ubuntu14.04_amd64.deb


安装mysql依赖的libaio1包

root@localhost:/usr/local/mysql5.6.30# apt-get install libaio1


安装msql-common包

root@localhost:/usr/local/mysql5.6.30# dpkg -i mysql-common_5.6.30-1ubuntu14.04_amd64.deb


安装cummunity的server包

root@localhost:/usr/local/mysql5.6.30# dpkg -i mysql-community-server_5.6.30-1ubuntu14.04_amd64.deb


回车(enter)确认

输入密码:XXXX

再次输入密码:XXXX

在安装过程需要输入root用户的密码,该密码需要牢记。

安装server包

root@localhost:/usr/local/mysql5.6.30# dpkg -i mysql-server_5.6.30-1ubuntu14.04_amd64.deb


安装client包

root@localhost:/usr/local/mysql5.6.30# dpkg -i mysql-community-client_5.6.30-1ubuntu14.04_amd64.deb


安装完成,测试安装是否正确

root@localhost:/usr/local/mysql5.6.30# mysql -uroot -p密码
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 2
Server version: 5.6.30 MySQL Community Server (GPL)

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>


修改配置文件

root@localhost:/usr/local/mysql5.6.30# vim /etc/mysql/my.cnf


[client]下添加

default-character-set = utf8mb4


[mysqld]下添加

character_set_server=utf8mb4
init_connect='SET NAMES utf8mb4'


bind-address修改为本机IP地址

举例:

[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
default-character-set = utf8mb4
[mysqld_safe]
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
nice = 0

[mysqld]
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
explicit_defaults_for_timestamp
character_set_server=utf8mb4 init_connect='SET NAMES utf8mb4'
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 192.168.1.159


重启mysql数据库

root@localhost:/usr/local/mysql5.6.30# service mysql restart


设置数据库的远程连接

root@localhost:/usr/local/mysql5.6.30# mysql -uroot -p密码
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 1
Server version: 5.6.30 MySQL Community Server (GPL)

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '密码' WITH GRANT OPTION;
Query OK, 0 rows affected (0.00 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)


远程访问测试

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  mysql 安装