Ubuntu-18 安装mysql-8
dpkg --list|grep mysql 查看是否有历史安装记录。空则表示没有。若有请清理历史记录。
wget -c https://dev.mysql.com/get/mysql-apt-config_0.8.10-1_all.deb
dpkg -i mysql-apt-config_0.8.10-1_all.deb
默认安装的就是8.0版本,选择OK
apt update
报错,签名过期了
Err:7 http://repo.mysql.com/apt/ubuntu bionic InRelease
The following signatures were invalid: EXPKEYSIG 8C718D3B5072E1F5 MySQL Release Engineering <mysql-build@oss.oracle.com>
Reading package lists... Done
W: GPG error: http://repo.mysql.com/apt/ubuntu bionic InRelease: The following signatures were invalid: EXPKEYSIG 8C718D3B5072E1F5 MySQL Release Engineering <mysql-build@oss.oracle.com>
E: The repository 'http://repo.mysql.com/apt/ubuntu bionic InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
解决:删除过期的签名,添加新的
apt-key list
apt-key del rsa4096
重新添加签名:
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 8C718D3B5072E1F5
重新更新:
apt update
安装mysql8:
apt install mysql-server
输入之后会出现选择加密方式的提示界面,我在网上的教程中看到默认的mysql8.0的加密方式与ubuntu18.04 不兼容,所以选择5.x的加密方式;建议选择下边的那个。
安装完,试试:
mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> show variables like '%low%';
+----------------------------+-----------------------------------+
| Variable_name | Value |
+----------------------------+-----------------------------------+
| log_slow_admin_statements | OFF |
| log_slow_extra | OFF |
| log_slow_slave_statements | OFF |
| low_priority_updates | OFF |
| lower_case_file_system | OFF |
| lower_case_table_names | 0 |
| max_allowed_packet | 67108864 |
| mysqlx_max_allowed_packet | 67108864 |
| slave_allow_batching | OFF |
| slave_max_allowed_packet | 1073741824 |
| slow_launch_time | 2 |
| slow_query_log | OFF |
| slow_query_log_file | /var/lib/mysql/dev-TBC63-slow.log |
| transaction_allow_batching | OFF |
+----------------------------+-----------------------------------+
14 rows in set (0.01 sec)
mysql> show variables like "%char%";
+--------------------------+--------------------------------+
| Variable_name | Value |
+--------------------------+--------------------------------+
| character_set_client | utf8mb4 |
| character_set_connection | utf8mb4 |
| character_set_database | utf8mb4 |
| character_set_filesystem | binary |
| character_set_results | utf8mb4 |
| character_set_server | utf8mb4 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql-8.0/charsets/ |
+--------------------------+--------------------------------+
8 rows in set (0.00 sec)
mysql>
大小写敏感的需要修改配置文件。
配置文件:
停止服务:
systemctl stop mysql.service
修改配置:
vi /etc/mysql/mysql.conf.d/mysqld.cnf
增加一行
lower_case_table_names = 1
启动:
systemctl start mysql.service