ubuntu 14.04 安装mysql

While MySql 5.5 is the default for Ubuntu 14.04, MySql 5.6 is available in the default repositories. It can be installed simply using:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install mysql-server-5.6

If you have existing data in a MySql 5.5 database, it should be migrated automatically. Though it is always a good idea to make a backup before doing a major upgrade.

First make a backup of the data in your existing database:

mysqldump --lock-all-tables -u root -p --all-databases > dump.sql
mysqldump -u USERNAME -p --default-character-set=utf8mb4 USER_DATABASE > backup.sql

Then after installing the newer version, you can restore if needed by running:

mysql -u root -p < dump.sql
mysql -u root -p 数据库名 < dump.sql
mysql -u USERNAME -p  --default-character-set=utf8mb4 USER_DATABASE < backup.sql

mysql修改远程连接

第一步:

vim /etc/mysql/my.cnf找到bind-address = 127.0.0.1

注释掉这行,如:#bind-address = 127.0.0.1

或者改为: bind-address = 0.0.0.0

允许任意IP访问;

或者自己指定一个IP地址。

重启 MySQL:sudo /etc/init.d/mysql restart

第二步:

授权用户能进行远程连接

   grant all privileges on *.* to root@"%" identified by "password" with grant option;

   flush privileges;

   第一行命令解释如下,*.*:第一个*代表数据库名;第二个*代表表名。这里的意思是所有数据库里的所有表都授权给用户。root:授予root账号。“%”:表示授权的用户IP可以指定,这里代表任意的IP地址都能访问MySQL数据库。“password”:分配账号对应的密码,这里密码自己替换成你的mysql root帐号密码。

   第二行命令是刷新权限信息,也即是让我们所作的设置马上生效。

为了消除linux环境下大小写敏感问题,设置如下:vi /etc/mysql/my.cnf

在[mysqld]中添加:

lower_case_table_names = 1;

utf8mb4配置

[mysqld] character-set-server = utf8mb4 [mysql] default-character-set = utf8mb4

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值