root@k8s-master-2K4G:~# sudo apt install mysql-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libcgi-fast-perl libcgi-pm-perl libfcgi-perl libhtml-template-perl
libmecab2 mecab-ipadic mecab-ipadic-utf8 mecab-utils mysql-client-8.0
mysql-client-core-8.0 mysql-common mysql-server-8.0 mysql-server-core-8.0
Suggested packages:
libipc-sharedcache-perl mailx tinyca
The following NEW packages will be installed:
libcgi-fast-perl libcgi-pm-perl libfcgi-perl libhtml-template-perl
libmecab2 mecab-ipadic mecab-ipadic-utf8 mecab-utils mysql-client-8.0
mysql-client-core-8.0 mysql-common mysql-server mysql-server-8.0
mysql-server-core-8.00 upgraded,14 newly installed,0 to remove and350not upgraded.
Need to get 36.3 MB of archives.
After this operation,316 MB of additional disk space will be used.
Do you want to continue?[Y/n]
装不上啊
root@k8s-master-2K4G:~# netstat -tanp^C root@k8s-master-2K4G:~# sudo apt install mysql-server Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: libcgi-fast-perl libcgi-pm-perl libfcgi-perl libhtml-template-perl libmecab2 mecab-ipadic mecab-ipadic-utf8 mecab-utils mysql-client-8.0 mysql-client-core-8.0 mysql-common mysql-server-8.0 mysql-server-core-8.0 Suggested packages: libipc-sharedcache-perl mailx tinyca The following NEW packages will be installed: libcgi-fast-perl libcgi-pm-perl libfcgi-perl libhtml-template-perl libmecab2 mecab-ipadic mecab-ipadic-utf8 mecab-utils mysql-client-8.0 mysql-client-core-8.0 mysql-common mysql-server mysql-server-8.0 mysql-server-core-8.0 0 upgraded, 14 newly installed, 0 to remove and 350 not upgraded. Need to get 36.3 MB of archives. After this operation, 316 MB of additional disk space will be used. Do you want to continue? [Y/n] y Get:1 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/main amd64 mysql-common all 5.8+1.0.5ubuntu2 [7496 B] Ign:2 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 mysql-client-core-8.0 amd64 8.0.34-0ubuntu0.20.04.1 Ign:3 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 mysql-client-8.0 amd64 8.0.34-0ubuntu0.20.04.1 Get:4 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/main amd64 libmecab2 amd64 0.996-10build1 [233 kB] Ign:5 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 mysql-server-core-8.0 amd64 8.0.34-0ubuntu0.20.04.1 Ign:6 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 mysql-server-8.0 amd64 8.0.34-0ubuntu0.20.04.1 Get:7 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/main amd64 libcgi-pm-perl all 4.46-1 [186 kB] Get:8 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/main amd64 libfcgi-perl amd64 0.79-1 [33.1 kB] Get:9 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/main amd64 libcgi-fast-perl all 1:2.15-1 [10.5 kB] Get:10 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/main amd64 libhtml-template-perl all 2.97-1 [59.0 kB] Get:11 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/main amd64 mecab-utils amd64 0.996-10build1 [4912 B] Get:12 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/main amd64 mecab-ipadic all 2.7.0-20070801+main-2.1 [6714 kB] Get:13 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/main amd64 mecab-ipadic-utf8 all 2.7.0-20070801+main-2.1 [4380 B] Ign:14 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 mysql-server all 8.0.34-0ubuntu0.20.04.1 Ign:2 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 mysql-client-core-8.0 amd64 8.0.34-0ubuntu0.20.04.1 Ign:3 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 mysql-client-8.0 amd64 8.0.34-0ubuntu0.20.04.1 Ign:5 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 mysql-server-core-8.0 amd64 8.0.34-0ubuntu0.20.04.1 Ign:6 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 mysql-server-8.0 amd64 8.0.34-0ubuntu0.20.04.1 Ign:14 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 mysql-server all 8.0.34-0ubuntu0.20.04.1 Ign:2 http://mirrors.aliyun.com/ubuntu focal-updates/main amd64 mysql-client-core-8.0 amd64 8.0.34-0ubuntu0.20.04.1 Ign:3 http://mirrors.aliyun.com/ubuntu focal-updates/main amd64 mysql-client-8.0 amd64 8.0.34-0ubuntu0.20.04.1 Ign:5 http://mirrors.aliyun.com/ubuntu focal-updates/main amd64 mysql-server-core-8.0 amd64 8.0.34-0ubuntu0.20.04.1 Ign:6 http://mirrors.aliyun.com/ubuntu focal-updates/main amd64 mysql-server-8.0 amd64 8.0.34-0ubuntu0.20.04.1 Ign:14 http://mirrors.aliyun.com/ubuntu focal-updates/main amd64 mysql-server all 8.0.34-0ubuntu0.20.04.1 Ign:2 http://mirrors.aliyun.com/ubuntu focal-updates/main amd64 mysql-client-core-8.0 amd64 8.0.34-0ubuntu0.20.04.1 Ign:3 http://mirrors.aliyun.com/ubuntu focal-updates/main amd64 mysql-client-8.0 amd64 8.0.34-0ubuntu0.20.04.1 Ign:5 http://mirrors.aliyun.com/ubuntu focal-updates/main amd64 mysql-server-core-8.0 amd64 8.0.34-0ubuntu0.20.04.1 Ign:6 http://mirrors.aliyun.com/ubuntu focal-updates/main amd64 mysql-server-8.0 amd64 8.0.34-0ubuntu0.20.04.1 Ign:14 http://mirrors.aliyun.com/ubuntu focal-updates/main amd64 mysql-server all 8.0.34-0ubuntu0.20.04.1 Ign:2 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 mysql-client-core-8.0 amd64 8.0.34-0ubuntu0.20.04.1 Err:2 http://cn.archive.ubuntu.com/ubuntu focal-updates/main amd64 mysql-client-core-8.0 amd64 8.0.34-0ubuntu0.20.04.1 404 Not Found [IP: 101.6.15.130 443] Ign:3 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 mysql-client-8.0 amd64 8.0.34-0ubuntu0.20.04.1 Err:3 http://cn.archive.ubuntu.com/ubuntu focal-updates/main amd64 mysql-client-8.0 amd64 8.0.34-0ubuntu0.20.04.1 404 Not Found [IP: 101.6.15.130 443] Ign:5 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 mysql-server-core-8.0 amd64 8.0.34-0ubuntu0.20.04.1 Err:5 http://cn.archive.ubuntu.com/ubuntu focal-updates/main amd64 mysql-server-core-8.0 amd64 8.0.34-0ubuntu0.20.04.1 404 Not Found [IP: 101.6.15.130 443] Ign:6 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 mysql-server-8.0 amd64 8.0.34-0ubuntu0.20.04.1 Err:6 http://cn.archive.ubuntu.com/ubuntu focal-updates/main amd64 mysql-server-8.0 amd64 8.0.34-0ubuntu0.20.04.1 404 Not Found [IP: 101.6.15.130 443] Ign:14 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 mysql-server all 8.0.34-0ubuntu0.20.04.1 Err:14 http://cn.archive.ubuntu.com/ubuntu focal-updates/main amd64 mysql-server all 8.0.34-0ubuntu0.20.04.1 404 Not Found [IP: 101.6.15.130 443] Fetched 7252 kB in 6s (1188 kB/s) E: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/pool/main/m/mysql-8.0/mysql-client-core-8.0_8.0.34-0ubuntu0.20.04.1_amd64.deb 404 Not Found [IP: 101.6.15.130 443] E: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/pool/main/m/mysql-8.0/mysql-client-8.0_8.0.34-0ubuntu0.20.04.1_amd64.deb 404 Not Found [IP: 101.6.15.130 443] E: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/pool/main/m/mysql-8.0/mysql-server-core-8.0_8.0.34-0ubuntu0.20.04.1_amd64.deb 404 Not Found [IP: 101.6.15.130 443] E: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/pool/main/m/mysql-8.0/mysql-server-8.0_8.0.34-0ubuntu0.20.04.1_amd64.deb 404 Not Found [IP: 101.6.15.130 443] E: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/pool/main/m/mysql-8.0/mysql-server_8.0.34-0ubuntu0.20.04.1_all.deb 404 Not Found [IP: 101.6.15.130 443] E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing? root@k8s-master-2K4G:~#
apt-get update 一下,有了
root@k8s-master-2K4G:~# sudo apt install mysql-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libcgi-fast-perl libcgi-pm-perl libfcgi-perl libhtml-template-perl
libmecab2 mecab-ipadic mecab-ipadic-utf8 mecab-utils mysql-client-8.0
mysql-client-core-8.0 mysql-common mysql-server-8.0 mysql-server-core-8.0
Suggested packages:
libipc-sharedcache-perl mailx tinyca
The following NEW packages will be installed:
libcgi-fast-perl libcgi-pm-perl libfcgi-perl libhtml-template-perl
libmecab2 mecab-ipadic mecab-ipadic-utf8 mecab-utils mysql-client-8.0
mysql-client-core-8.0 mysql-common mysql-server mysql-server-8.0
mysql-server-core-8.0
0 upgraded, 14 newly installed, 0 to remove and 364 not upgraded.
Need to get 29.1 MB/36.3 MB of archives.
After this operation, 316 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 mysql-client-core-8.0 amd64 8.0.35-0ubuntu0.20.04.1 [5079 kB]
Get:2 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 mysql-client-8.0 amd64 8.0.35-0ubuntu0.20.04.1 [22.0 kB]
Get:3 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 mysql-server-core-8.0 amd64 8.0.35-0ubuntu0.20.04.1 [22.6 MB]61% [3 mysql-server-core-8.0 8241 kB/22.6 MB 36%]2496 kB/s 6s
done!
update-alternatives: using /var/lib/mecab/dic/ipadic to provide /var/lib/mecab/dic/debian (mecab-dictionary)in auto mode
Setting up libcgi-fast-perl (1:2.15-1)...
Setting up mecab-ipadic-utf8 (2.7.0-20070801+main-2.1)...
Compiling IPA dictionary for Mecab. This takes long time...
reading /usr/share/mecab/dic/ipadic/unk.def ... 40
emitting double-array: 100% |###########################################|
/usr/share/mecab/dic/ipadic/model.def is not found. skipped.
reading /usr/share/mecab/dic/ipadic/Noun.place.csv ... 72999
reading /usr/share/mecab/dic/ipadic/Noun.name.csv ... 34202
reading /usr/share/mecab/dic/ipadic/Adverb.csv ... 3032
reading /usr/share/mecab/dic/ipadic/Postp.csv ... 146
reading /usr/share/mecab/dic/ipadic/Noun.org.csv ... 16668
reading /usr/share/mecab/dic/ipadic/Others.csv ... 2
reading /usr/share/mecab/dic/ipadic/Prefix.csv ... 221
reading /usr/share/mecab/dic/ipadic/Noun.demonst.csv ... 120
reading /usr/share/mecab/dic/ipadic/Noun.number.csv ... 42
reading /usr/share/mecab/dic/ipadic/Noun.adverbal.csv ... 795
reading /usr/share/mecab/dic/ipadic/Noun.adjv.csv ... 3328
reading /usr/share/mecab/dic/ipadic/Auxil.csv ... 199
reading /usr/share/mecab/dic/ipadic/Verb.csv ... 130750
reading /usr/share/mecab/dic/ipadic/Postp-col.csv ... 91
reading /usr/share/mecab/dic/ipadic/Symbol.csv ... 208
reading /usr/share/mecab/dic/ipadic/Noun.csv ... 60477
reading /usr/share/mecab/dic/ipadic/Interjection.csv ... 252
reading /usr/share/mecab/dic/ipadic/Noun.proper.csv ... 27328
reading /usr/share/mecab/dic/ipadic/Noun.verbal.csv ... 12146
reading /usr/share/mecab/dic/ipadic/Suffix.csv ... 1393
reading /usr/share/mecab/dic/ipadic/Noun.nai.csv ... 42
reading /usr/share/mecab/dic/ipadic/Filler.csv ... 19
reading /usr/share/mecab/dic/ipadic/Conjunction.csv ... 171
reading /usr/share/mecab/dic/ipadic/Adj.csv ... 27210
reading /usr/share/mecab/dic/ipadic/Noun.others.csv ... 151
reading /usr/share/mecab/dic/ipadic/Adnominal.csv ... 135
emitting double-array: 100% |###########################################|
reading /usr/share/mecab/dic/ipadic/matrix.def ... 1316x1316
emitting matrix :100% |###########################################|
done!
update-alternatives: using /var/lib/mecab/dic/ipadic-utf8 to provide /var/lib/mecab/dic/debian (mecab-dictionary)in auto mode
Setting up mysql-server (8.0.35-0ubuntu0.20.04.1)...
Processing triggers for systemd (245.4-4ubuntu3.14)...
Processing triggers for man-db (2.9.1-1)...
Processing triggers for libc-bin (2.31-0ubuntu9.4)...
root@k8s-master-2K4G:~#
验证是否启动
登录开始是没有密码的
直接回车:
修改密码
// 新密码为123456
ALTER USER “root”@“localhost” IDENTIFIED BY “123456”;
还是不行
mysql> ALTER USER “root”@“localhost” IDENTIFIED BY “123456”;
ERROR 1064(42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '“123456”' at line 1
mysql> GRANT ALL PRIVILEGES ON *.* TO 'administrator'@'localhost' IDENTIFIED BY '123456';
ERROR 1064(42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IDENTIFIED BY '123456'' at line 1
mysql>
8.0的正确写法
USE mysql;
CREATE USER'user'@'localhost' IDENTIFIED BY 'P@ssW0rd';
GRANT ALL ON *.* TO 'user'@'localhost';
FLUSH PRIVILEGES;
实操:
mysql> CREATE USER'admin'@'localhost' IDENTIFIED BY 'passwd';
Query OK, 0 rows affected (0.02 sec)
mysql> GRANT ALL ON *.* TO 'admin'@'localhost';
Query OK, 0 rows affected (0.01 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)
mysql>