曾经在中标麒麟上安装过mysql,记录一下。不具有普遍性,仅供参考。
1 [lssecure@localhost mysql]$ su 2 密码: 3 [root@localhost mysql]# rpm -ivh qt-mysql-4.8.4-19.nk.1.i686.rpm 4 警告:qt-mysql-4.8.4-19.nk.1.i686.rpm: Header V4 RSA/SHA1 Signature, key ID 34fe765a: NOKEY 5 错误:Failed dependencies: 6 libmysqlclient.so.18 is needed by qt-mysql-1:4.8.4-19.nk.1.i686 7 libmysqlclient.so.18(libmysqlclient_16) is needed by qt-mysql-1:4.8.4-19.nk.1.i686 8 [root@localhost mysql]# rpm -ivh mariadb-libs-5.5.39-1.nk.1.i686.rpm 9 警告:mariadb-libs-5.5.39-1.nk.1.i686.rpm: Header V4 RSA/SHA1 Signature, key ID 34fe765a: NOKEY 10 准备中... ################################# [100%] 11 正在升级/安装... 12 1:mariadb-libs-1:5.5.39-1.nk.1 ################################# [100%] 13 /sbin/ldconfig: /opt/remote-viewer/libs/libspice-client-gtk-2.0.so.1 不是符号连接 14 15 /sbin/ldconfig: /opt/remote-viewer/libs/libspice-client-glib-2.0.so.1 不是符号连接 16 17 /sbin/ldconfig: /opt/remote-viewer/libs/libspice-controller.so.0 不是符号连接 18 19 [root@localhost mysql]# rpm -ivh qt-mysql-4.8.4-19.nk.1.i686.rpm 20 警告:qt-mysql-4.8.4-19.nk.1.i686.rpm: Header V4 RSA/SHA1 Signature, key ID 34fe765a: NOKEY 21 准备中... ################################# [100%] 22 正在升级/安装... 23 1:qt-mysql-1:4.8.4-19.nk.1 ################################# [100%] 24 [root@localhost mysql]# rpm -ivh mariadb-server-5.5.39-1.nk.1.i686.rpm 25 警告:mariadb-server-5.5.39-1.nk.1.i686.rpm: Header V4 RSA/SHA1 Signature, key ID 34fe765a: NOKEY 26 错误:Failed dependencies: 27 mariadb(x86-32) = 1:5.5.39-1.nk.1 is needed by mariadb-server-1:5.5.39-1.nk.1.i686 28 perl(DBI) is needed by mariadb-server-1:5.5.39-1.nk.1.i686 29 perl-DBD-MySQL is needed by mariadb-server-1:5.5.39-1.nk.1.i686 30 perl-DBI is needed by mariadb-server-1:5.5.39-1.nk.1.i686 31 [root@localhost mysql]# rpm -ivh 32 rpm:未给出要安装的软件包 33 [root@localhost mysql]# rpm -ivh perl-BDB-1.90-4.nk.1.i686.rpm 34 警告:perl-BDB-1.90-4.nk.1.i686.rpm: Header V4 RSA/SHA1 Signature, key ID 34fe765a: NOKEY 35 错误:Failed dependencies: 36 perl(common::sense) is needed by perl-BDB-1.90-4.nk.1.i686 37 [root@localhost mysql]# rpm -ivh perl-DBD-MySQL-4.023-2.nk.1.i686.rpm 38 警告:perl-DBD-MySQL-4.023-2.nk.1.i686.rpm: Header V4 RSA/SHA1 Signature, key ID 34fe765a: NOKEY 39 错误:Failed dependencies: 40 perl(DBI) is needed by perl-DBD-MySQL-4.023-2.nk.1.i686 41 perl(DBI::Const::GetInfoType) is needed by perl-DBD-MySQL-4.023-2.nk.1.i686 42 [root@localhost mysql]# rpm -ivh perl-DBI-1.623-2.nk.1.i686.rpm 43 警告:perl-DBI-1.623-2.nk.1.i686.rpm: Header V4 RSA/SHA1 Signature, key ID 34fe765a: NOKEY 44 错误:Failed dependencies: 45 perl(Coro) is needed by perl-DBI-1.623-2.nk.1.i686 46 perl(Coro::Handle) is needed by perl-DBI-1.623-2.nk.1.i686 47 perl(Coro::Select) is needed by perl-DBI-1.623-2.nk.1.i686 48 perl(RPC::PlClient) >= 0.2000 is needed by perl-DBI-1.623-2.nk.1.i686 49 perl(RPC::PlServer) >= 0.2001 is needed by perl-DBI-1.623-2.nk.1.i686 50 [root@localhost mysql]# 51 [root@localhost mysql]# rpm -ivh perl-Coro-6.23-2.nk.1.i686.rpm 52 警告:perl-Coro-6.23-2.nk.1.i686.rpm: Header V4 RSA/SHA1 Signature, key ID 34fe765a: NOKEY 53 错误:Failed dependencies: 54 perl(AnyEvent) >= 7 is needed by perl-Coro-6.23-2.nk.1.i686 55 perl(AnyEvent::AIO) >= 1 is needed by perl-Coro-6.23-2.nk.1.i686 56 perl(AnyEvent::BDB) >= 1 is needed by perl-Coro-6.23-2.nk.1.i686 57 perl(AnyEvent::DNS) is needed by perl-Coro-6.23-2.nk.1.i686 58 perl(AnyEvent::Socket) is needed by perl-Coro-6.23-2.nk.1.i686 59 perl(AnyEvent::Util) is needed by perl-Coro-6.23-2.nk.1.i686 60 perl(BDB) is needed by perl-Coro-6.23-2.nk.1.i686 61 perl(EV) >= 4 is needed by perl-Coro-6.23-2.nk.1.i686 62 perl(Event) >= 1.08 is needed by perl-Coro-6.23-2.nk.1.i686 63 perl(Guard) >= 0.5 is needed by perl-Coro-6.23-2.nk.1.i686 64 perl(IO::AIO) >= 3.1 is needed by perl-Coro-6.23-2.nk.1.i686 65 perl(common::sense) is needed by perl-Coro-6.23-2.nk.1.i686 66 [root@localhost mysql]# rpm -ivh perl-AnyEvent-7.04-2.nk.1.i686.rpm 67 警告:perl-AnyEvent-7.04-2.nk.1.i686.rpm: Header V4 RSA/SHA1 Signature, key ID 34fe765a: NOKEY 68 错误:Failed dependencies: 69 perl(Task::Weaken) is needed by perl-AnyEvent-7.04-2.nk.1.i686 70 [root@localhost mysql]# rpm -ivh perl-Task-Weaken-1.04-6.nk.1.noarch.rpm 71 警告:perl-Task-Weaken-1.04-6.nk.1.noarch.rpm: Header V4 RSA/SHA1 Signature, key ID 34fe765a: NOKEY 72 准备中... ################################# [100%] 73 正在升级/安装... 74 1:perl-Task-Weaken-1.04-6.nk.1 ################################# [100%] 75 [root@localhost mysql]# rpm -ivh perl-Coro-6.23-2.nk.1.i686.rpm 76 警告:perl-Coro-6.23-2.nk.1.i686.rpm: Header V4 RSA/SHA1 Signature, key ID 34fe765a: NOKEY 77 错误:Failed dependencies: 78 perl(AnyEvent) >= 7 is needed by perl-Coro-6.23-2.nk.1.i686 79 perl(AnyEvent::AIO) >= 1 is needed by perl-Coro-6.23-2.nk.1.i686 80 perl(AnyEvent::BDB) >= 1 is needed by perl-Coro-6.23-2.nk.1.i686 81 perl(AnyEvent::DNS) is needed by perl-Coro-6.23-2.nk.1.i686 82 perl(AnyEvent::Socket) is needed by perl-Coro-6.23-2.nk.1.i686 83 perl(AnyEvent::Util) is needed by perl-Coro-6.23-2.nk.1.i686 84 perl(BDB) is needed by perl-Coro-6.23-2.nk.1.i686 85 perl(EV) >= 4 is needed by perl-Coro-6.23-2.nk.1.i686 86 perl(Event) >= 1.08 is needed by perl-Coro-6.23-2.nk.1.i686 87 perl(Guard) >= 0.5 is needed by perl-Coro-6.23-2.nk.1.i686 88 perl(IO::AIO) >= 3.1 is needed by perl-Coro-6.23-2.nk.1.i686 89 perl(common::sense) is needed by perl-Coro-6.23-2.nk.1.i686 90 [root@localhost mysql]# rpm -ivh perl-AnyEvent-7.04-2.nk.1.i686.rpm 91 警告:perl-AnyEvent-7.04-2.nk.1.i686.rpm: Header V4 RSA/SHA1 Signature, key ID 34fe765a: NOKEY 92 准备中... ################################# [100%] 93 正在升级/安装... 94 1:perl-AnyEvent-7.04-2.nk.1 ################################# [100%] 95 [root@localhost mysql]# rpm -ivh perl-DBD-MySQL-4.023-2.nk.1.i686.rpm 96 警告:perl-DBD-MySQL-4.023-2.nk.1.i686.rpm: Header V4 RSA/SHA1 Signature, key ID 34fe765a: NOKEY 97 错误:Failed dependencies: 98 perl(DBI) is needed by perl-DBD-MySQL-4.023-2.nk.1.i686 99 perl(DBI::Const::GetInfoType) is needed by perl-DBD-MySQL-4.023-2.nk.1.i686 100 [root@localhost mysql]# ls 101 keyutils-libs-devel-1.5.5-4.nk.1.i686.rpm 102 krb5-devel-1.11.3-1.nk.1.i686.rpm 103 libcom_err-devel-1.42.7-2.nk.1.i686.rpm 104 libdbi-0.8.4-3.nk.1.i686.rpm 105 libdbi-dbd-mysql-0.8.3-12.nk.1.i686.rpm 106 libdbi-drivers-0.8.3-12.nk.1.i686.rpm 107 libselinux-devel-2.1.13-15.nk.1.i686.rpm 108 libsepol-devel-2.1.9-1.nk.1.i686.rpm 109 libverto-devel-0.2.5-2.nk.1.i686.rpm 110 libzip-0.10.1-6.nk.1.i686.rpm 111 mariadb-5.5.39-1.nk.1.i686.rpm 112 mariadb-bench-5.5.39-1.nk.1.i686.rpm 113 mariadb-devel-5.5.39-1.nk.1.i686.rpm 114 mariadb-libs-5.5.39-1.nk.1.i686.rpm 115 mariadb-server-5.5.39-1.nk.1.i686.rpm 116 mysql-connector-odbc-5.2.5-1.nk.1.i686.rpm 117 MySQL-python-1.2.3-7.nk.1.i686.rpm 118 mysqltuner-1.2.0-4.nk.1.noarch.rpm 119 openssl-devel-1.0.1e-4.nk.1.i686.rpm 120 perl-AnyEvent-7.04-2.nk.1.i686.rpm 121 perl-AnyEvent-AIO-1.1-11.nk.1.noarch.rpm 122 perl-AnyEvent-BDB-1.1-10.nk.1.noarch.rpm 123 perl-BDB-1.90-4.nk.1.i686.rpm 124 perl-common-sense-3.6-4.nk.1.noarch.rpm 125 perl-Coro-6.23-2.nk.1.i686.rpm 126 perl-DBD-MySQL-4.023-2.nk.1.i686.rpm 127 perl-DBI-1.623-2.nk.1.i686.rpm 128 perl-EV-4.11-2.nk.1.i686.rpm 129 perl-Event-1.21-2.nk.1.i686.rpm 130 perl-GD-2.46-3.nk.1.i686.rpm 131 perl-Guard-1.022-4.nk.1.i686.rpm 132 perl-IO-AIO-4.15-4.nk.1.i686.rpm 133 perl-Net-Daemon-0.48-5.nk.1.noarch.rpm 134 perl-PlRPC-0.2020-13.nk.1.noarch.rpm 135 perl-Task-Weaken-1.04-6.nk.1.noarch.rpm 136 php-cli-5.5.0-0.10.RC3.nk.1.i686.rpm 137 php-common-5.5.0-0.10.RC3.nk.1.i686.rpm 138 php-mysqlnd-5.5.0-0.10.RC3.nk.1.i686.rpm 139 php-pdo-5.5.0-0.10.RC3.nk.1.i686.rpm 140 php-pear-1.9.4-18.nk.1.noarch.rpm 141 php-pecl-jsonc-1.3.1-1.nk.1.i686.rpm 142 php-process-5.5.0-0.10.RC3.nk.1.i686.rpm 143 php-xml-5.5.0-0.10.RC3.nk.1.i686.rpm 144 qt3-MySQL-3.3.8b-58.nk.1.i686.rpm 145 qt-mysql-4.8.4-19.nk.1.i686.rpm 146 unixODBC-2.3.1-4.nk.1.i686.rpm 147 zlib-devel-1.2.7-10.nk.1.i686.rpm 148 [root@localhost mysql]# rpm -ivh perl-DBI-1.623-2.nk.1.i686.rpm 149 警告:perl-DBI-1.623-2.nk.1.i686.rpm: Header V4 RSA/SHA1 Signature, key ID 34fe765a: NOKEY 150 错误:Failed dependencies: 151 perl(Coro) is needed by perl-DBI-1.623-2.nk.1.i686 152 perl(Coro::Handle) is needed by perl-DBI-1.623-2.nk.1.i686 153 perl(Coro::Select) is needed by perl-DBI-1.623-2.nk.1.i686 154 perl(RPC::PlClient) >= 0.2000 is needed by perl-DBI-1.623-2.nk.1.i686 155 perl(RPC::PlServer) >= 0.2001 is needed by perl-DBI-1.623-2.nk.1.i686 156 [root@localhost mysql]# rpm -ivh perl-Coro-6.23-2.nk.1.i686.rpm 157 警告:perl-Coro-6.23-2.nk.1.i686.rpm: Header V4 RSA/SHA1 Signature, key ID 34fe765a: NOKEY 158 错误:Failed dependencies: 159 perl(AnyEvent::AIO) >= 1 is needed by perl-Coro-6.23-2.nk.1.i686 160 perl(AnyEvent::BDB) >= 1 is needed by perl-Coro-6.23-2.nk.1.i686 161 perl(BDB) is needed by perl-Coro-6.23-2.nk.1.i686 162 perl(EV) >= 4 is needed by perl-Coro-6.23-2.nk.1.i686 163 perl(Event) >= 1.08 is needed by perl-Coro-6.23-2.nk.1.i686 164 perl(Guard) >= 0.5 is needed by perl-Coro-6.23-2.nk.1.i686 165 perl(IO::AIO) >= 3.1 is needed by perl-Coro-6.23-2.nk.1.i686 166 perl(common::sense) is needed by perl-Coro-6.23-2.nk.1.i686 167 [root@localhost mysql]# rpm -ivh perl-AnyEvent-AIO-1.1-11.nk.1.noarch.rpm 168 警告:perl-AnyEvent-AIO-1.1-11.nk.1.noarch.rpm: Header V4 RSA/SHA1 Signature, key ID 34fe765a: NOKEY 169 错误:Failed dependencies: 170 perl(IO::AIO) is needed by perl-AnyEvent-AIO-1.1-11.nk.1.noarch 171 [root@localhost mysql]# rpm -ivh perl-IO-AIO-4.15-4.nk.1.i686.rpm 172 警告:perl-IO-AIO-4.15-4.nk.1.i686.rpm: Header V4 RSA/SHA1 Signature, key ID 34fe765a: NOKEY 173 错误:Failed dependencies: 174 perl(common::sense) is needed by perl-IO-AIO-4.15-4.nk.1.i686 175 [root@localhost mysql]# rpm -ivh perl-common-sense-3.6-4.nk.1.noarch.rpm 176 警告:perl-common-sense-3.6-4.nk.1.noarch.rpm: Header V4 RSA/SHA1 Signature, key ID 34fe765a: NOKEY 177 准备中... ################################# [100%] 178 正在升级/安装... 179 1:perl-common-sense-3.6-4.nk.1 ################################# [100%] 180 [root@localhost mysql]# rpm -ivh perl-IO-AIO-4.15-4.nk.1.i686.rpm 181 警告:perl-IO-AIO-4.15-4.nk.1.i686.rpm: Header V4 RSA/SHA1 Signature, key ID 34fe765a: NOKEY 182 准备中... ################################# [100%] 183 正在升级/安装... 184 1:perl-IO-AIO-4.15-4.nk.1 ################################# [100%] 185 [root@localhost mysql]# rpm -ivh perl-AnyEvent-AIO-1.1-11.nk.1.noarch.rpm 186 警告:perl-AnyEvent-AIO-1.1-11.nk.1.noarch.rpm: Header V4 RSA/SHA1 Signature, key ID 34fe765a: NOKEY 187 准备中... ################################# [100%] 188 正在升级/安装... 189 1:perl-AnyEvent-AIO-1.1-11.nk.1 ################################# [100%] 190 [root@localhost mysql]# rpm -ivh perl-AnyEvent-BDB-1.1-10.nk.1.noarch.rpm 191 警告:perl-AnyEvent-BDB-1.1-10.nk.1.noarch.rpm: Header V4 RSA/SHA1 Signature, key ID 34fe765a: NOKEY 192 错误:Failed dependencies: 193 perl(BDB) is needed by perl-AnyEvent-BDB-1.1-10.nk.1.noarch 194 [root@localhost mysql]# rpm -ivh perl-BDB-1.90-4.nk.1.i686.rpm 195 警告:perl-BDB-1.90-4.nk.1.i686.rpm: Header V4 RSA/SHA1 Signature, key ID 34fe765a: NOKEY 196 准备中... ################################# [100%] 197 正在升级/安装... 198 1:perl-BDB-1.90-4.nk.1 ################################# [100%] 199 [root@localhost mysql]# rpm -ivh perl-AnyEvent-BDB-1.1-10.nk.1.noarch.rpm 200 警告:perl-AnyEvent-BDB-1.1-10.nk.1.noarch.rpm: Header V4 RSA/SHA1 Signature, key ID 34fe765a: NOKEY 201 准备中... ################################# [100%] 202 正在升级/安装... 203 1:perl-AnyEvent-BDB-1.1-10.nk.1 ################################# [100%] 204 [root@localhost mysql]# rpm -ivh perl-EV-4.11-2.nk.1.i686.rpm 205 警告:perl-EV-4.11-2.nk.1.i686.rpm: Header V4 RSA/SHA1 Signature, key ID 34fe765a: NOKEY 206 准备中... ################################# [100%] 207 正在升级/安装... 208 1:perl-EV-4.11-2.nk.1 ################################# [100%] 209 [root@localhost mysql]# rpm -ivh perl-Event-1.21-2.nk.1.i686.rpm 210 警告:perl-Event-1.21-2.nk.1.i686.rpm: Header V4 RSA/SHA1 Signature, key ID 34fe765a: NOKEY 211 准备中... ################################# [100%] 212 正在升级/安装... 213 1:perl-Event-1.21-2.nk.1 ################################# [100%] 214 [root@localhost mysql]# rpm -ivh perl-Guard-1.022-4.nk.1.i686.rpm 215 警告:perl-Guard-1.022-4.nk.1.i686.rpm: Header V4 RSA/SHA1 Signature, key ID 34fe765a: NOKEY 216 准备中... ################################# [100%] 217 正在升级/安装... 218 1:perl-Guard-1.022-4.nk.1 ################################# [100%] 219 [root@localhost mysql]# rpm -ivh perl-Coro-6.23-2.nk.1.i686.rpm 220 警告:perl-Coro-6.23-2.nk.1.i686.rpm: Header V4 RSA/SHA1 Signature, key ID 34fe765a: NOKEY 221 准备中... ################################# [100%] 222 正在升级/安装... 223 1:perl-Coro-6.23-2.nk.1 ################################# [100%] 224 [root@localhost mysql]# rpm -ivh perl-PlRPC-0.2020-13.nk.1.noarch.rpm 225 警告:perl-PlRPC-0.2020-13.nk.1.noarch.rpm: Header V4 RSA/SHA1 Signature, key ID 34fe765a: NOKEY 226 错误:Failed dependencies: 227 perl(Net::Daemon) >= 0.13 is needed by perl-PlRPC-0.2020-13.nk.1.noarch 228 perl(Net::Daemon::Log) is needed by perl-PlRPC-0.2020-13.nk.1.noarch 229 perl(Net::Daemon::Test) is needed by perl-PlRPC-0.2020-13.nk.1.noarch 230 [root@localhost mysql]# rpm -ivh perl-DBI-1.623-2.nk.1.i686.rpm 231 警告:perl-DBI-1.623-2.nk.1.i686.rpm: Header V4 RSA/SHA1 Signature, key ID 34fe765a: NOKEY 232 错误:Failed dependencies: 233 perl(RPC::PlClient) >= 0.2000 is needed by perl-DBI-1.623-2.nk.1.i686 234 perl(RPC::PlServer) >= 0.2001 is needed by perl-DBI-1.623-2.nk.1.i686 235 [root@localhost mysql]# rpm -ivh perl-Net-Daemon-0.48-5.nk.1.noarch.rpm 236 警告:perl-Net-Daemon-0.48-5.nk.1.noarch.rpm: Header V4 RSA/SHA1 Signature, key ID 34fe765a: NOKEY 237 准备中... ################################# [100%] 238 正在升级/安装... 239 1:perl-Net-Daemon-0.48-5.nk.1 ################################# [100%] 240 [root@localhost mysql]# rpm -ivh perl-PlRPC-0.2020-13.nk.1.noarch.rpm 241 警告:perl-PlRPC-0.2020-13.nk.1.noarch.rpm: Header V4 RSA/SHA1 Signature, key ID 34fe765a: NOKEY 242 准备中... ################################# [100%] 243 正在升级/安装... 244 1:perl-PlRPC-0.2020-13.nk.1 ################################# [100%] 245 [root@localhost mysql]# rpm -ivh perl-DBI-1.623-2.nk.1.i686.rpm 246 警告:perl-DBI-1.623-2.nk.1.i686.rpm: Header V4 RSA/SHA1 Signature, key ID 34fe765a: NOKEY 247 准备中... ################################# [100%] 248 正在升级/安装... 249 1:perl-DBI-1.623-2.nk.1 ################################# [100%] 250 [root@localhost mysql]# rpm -ivh perl-DBD-MySQL-4.023-2.nk.1.i686.rpm 251 警告:perl-DBD-MySQL-4.023-2.nk.1.i686.rpm: Header V4 RSA/SHA1 Signature, key ID 34fe765a: NOKEY 252 准备中... ################################# [100%] 253 正在升级/安装... 254 1:perl-DBD-MySQL-4.023-2.nk.1 ################################# [100%] 255 [root@localhost mysql]# rpm -ivh mariadb-server-5.5.39-1.nk.1.i686.rpm 256 警告:mariadb-server-5.5.39-1.nk.1.i686.rpm: Header V4 RSA/SHA1 Signature, key ID 34fe765a: NOKEY 257 错误:Failed dependencies: 258 mariadb(x86-32) = 1:5.5.39-1.nk.1 is needed by mariadb-server-1:5.5.39-1.nk.1.i686 259 [root@localhost mysql]# rpm -ivh mariadb-5.5.39-1.nk.1.i686.rpm 260 警告:mariadb-5.5.39-1.nk.1.i686.rpm: Header V4 RSA/SHA1 Signature, key ID 34fe765a: NOKEY 261 准备中... ################################# [100%] 262 正在升级/安装... 263 1:mariadb-1:5.5.39-1.nk.1 ################################# [100%] 264 [root@localhost mysql]# rpm -ivh mariadb-server-5.5.39-1.nk.1.i686.rpm 265 警告:mariadb-server-5.5.39-1.nk.1.i686.rpm: Header V4 RSA/SHA1 Signature, key ID 34fe765a: NOKEY 266 准备中... ################################# [100%] 267 正在升级/安装... 268 1:mariadb-server-1:5.5.39-1.nk.1 ################################# [100%] 269 [root@localhost mysql]# vi /etc/my.cnf 270 [root@localhost mysql]# vi /etc/my.cnf 271 [root@localhost mysql]# vi /etc/my.cnf.d/client.cnf 272 [root@localhost mysql]# vi /etc/my.cnf.d/mysql-clients.cnf 273 [root@localhost mysql]# systemctl restart mariadb 274 [root@localhost mysql]# mysql -u root -p 275 Enter password: 276 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) 277 [root@localhost mysql]# mysql -u root -p 278 Enter password: 279 Welcome to the MariaDB monitor. Commands end with ; or \g. 280 Your MariaDB connection id is 3 281 Server version: 5.5.39-MariaDB MariaDB Server 282 283 Copyright (c) 2000, 2014, Oracle, Monty Program Ab and others. 284 285 Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. 286 287 MariaDB [(none)]> show variables like "%character%";show variables like "%collation%"; 288 +--------------------------+----------------------------+ 289 | Variable_name | Value | 290 +--------------------------+----------------------------+ 291 | character_set_client | utf8 | 292 | character_set_connection | utf8 | 293 | character_set_database | utf8 | 294 | character_set_filesystem | binary | 295 | character_set_results | utf8 | 296 | character_set_server | utf8 | 297 | character_set_system | utf8 | 298 | character_sets_dir | /usr/share/mysql/charsets/ | 299 +--------------------------+----------------------------+ 300 8 rows in set (0.00 sec) 301 302 +----------------------+-----------------+ 303 | Variable_name | Value | 304 +----------------------+-----------------+ 305 | collation_connection | utf8_unicode_ci | 306 | collation_database | utf8_unicode_ci | 307 | collation_server | utf8_unicode_ci | 308 +----------------------+-----------------+ 309 3 rows in set (0.00 sec) 310 311 MariaDB [(none)]> Ctrl-C -- exit! 312 Aborted 313 [root@localhost mysql]# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld 314 cp: 无法获取"/usr/local/mysql/support-files/mysql.server" 的文件状态(stat): 没有那个文件或目录 315 [root@localhost mysql]# mysql -uroot -p 316 Enter password: 317 Welcome to the MariaDB monitor. Commands end with ; or \g. 318 Your MariaDB connection id is 4 319 Server version: 5.5.39-MariaDB MariaDB Server 320 321 Copyright (c) 2000, 2014, Oracle, Monty Program Ab and others. 322 323 Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. 324 325 MariaDB [(none)]> Ctrl-C -- exit! 326 Aborted 327 [root@localhost mysql]# mysqladmin -u root -p password lssecure 328 Enter password: 329 [root@localhost mysql]# mysql -uroot -p 330 Enter password: 331 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) 332 [root@localhost mysql]# mysql -uroot -p 333 Enter password: 334 Welcome to the MariaDB monitor. Commands end with ; or \g. 335 Your MariaDB connection id is 7 336 Server version: 5.5.39-MariaDB MariaDB Server 337 338 Copyright (c) 2000, 2014, Oracle, Monty Program Ab and others. 339 340 Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. 341 342 MariaDB [(none)]> Ctrl-C -- exit! 343 Aborted 344 [root@localhost mysql]# 345 346 347 348 [root@localhost mysql]# yum search mysql 349 已加载插件:langpacks, refresh-packagekit 350 http://download.cs2c.com.cn/neokylin/desktop/releases/4.0/i386/zy/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found 351 正在尝试其它镜像。 352 错误:failure: repodata/repomd.xml from neokylin: [Errno 256] No more mirrors to try. 353 http://download.cs2c.com.cn/neokylin/desktop/releases/4.0/i386/zy/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found 354 [root@localhost mysql]# rpm -ivh mariadb-devel-5.5.39-1.nk.1.i686.rpm 355 警告:mariadb-devel-5.5.39-1.nk.1.i686.rpm: Header V4 RSA/SHA1 Signature, key ID 34fe765a: NOKEY 356 错误:Failed dependencies: 357 openssl-devel(x86-32) is needed by mariadb-devel-1:5.5.39-1.nk.1.i686 358 [root@localhost mysql]# rpm -ivh openssl-devel-1.0.1e-4.nk.1.i686.rpm 359 警告:openssl-devel-1.0.1e-4.nk.1.i686.rpm: Header V4 RSA/SHA1 Signature, key ID 34fe765a: NOKEY 360 错误:Failed dependencies: 361 krb5-devel(x86-32) is needed by openssl-devel-1:1.0.1e-4.nk.1.i686 362 [root@localhost mysql]# rpm -ivh krb5-devel-1.11.3-1.nk.1.i686.rpm 363 警告:krb5-devel-1.11.3-1.nk.1.i686.rpm: Header V4 RSA/SHA1 Signature, key ID 34fe765a: NOKEY 364 错误:Failed dependencies: 365 keyutils-libs-devel is needed by krb5-devel-1.11.3-1.nk.1.i686 366 libcom_err-devel is needed by krb5-devel-1.11.3-1.nk.1.i686 367 libselinux-devel is needed by krb5-devel-1.11.3-1.nk.1.i686 368 libverto-devel is needed by krb5-devel-1.11.3-1.nk.1.i686 369 [root@localhost mysql]# rpm -ivh keyutils-libs-devel-1.5.5-4.nk.1.i686.rpm 370 警告:keyutils-libs-devel-1.5.5-4.nk.1.i686.rpm: Header V4 RSA/SHA1 Signature, key ID 34fe765a: NOKEY 371 准备中... ################################# [100%] 372 正在升级/安装... 373 1:keyutils-libs-devel-1.5.5-4.nk.1 ################################# [100%] 374 [root@localhost mysql]# rpm -ivh libselinux-devel-2.1.13-15.nk.1.i686.rpm 375 警告:libselinux-devel-2.1.13-15.nk.1.i686.rpm: Header V4 RSA/SHA1 Signature, key ID 34fe765a: NOKEY 376 错误:Failed dependencies: 377 libsepol-devel >= 2.1.9-1 is needed by libselinux-devel-2.1.13-15.nk.1.i686 378 pkgconfig(libsepol) is needed by libselinux-devel-2.1.13-15.nk.1.i686 379 [root@localhost mysql]# rpm -ivh libsepol-devel-2.1.9-1.nk.1.i686.rpm 380 警告:libsepol-devel-2.1.9-1.nk.1.i686.rpm: Header V4 RSA/SHA1 Signature, key ID 34fe765a: NOKEY 381 准备中... ################################# [100%] 382 正在升级/安装... 383 1:libsepol-devel-2.1.9-1.nk.1 ################################# [100%] 384 [root@localhost mysql]# rpm -ivh libselinux-devel-2.1.13-15.nk.1.i686.rpm 385 警告:libselinux-devel-2.1.13-15.nk.1.i686.rpm: Header V4 RSA/SHA1 Signature, key ID 34fe765a: NOKEY 386 准备中... ################################# [100%] 387 正在升级/安装... 388 1:libselinux-devel-2.1.13-15.nk.1 ################################# [100%] 389 [root@localhost mysql]# rpm -ivh libverto-devel-0.2.5-2.nk.1.i686.rpm 390 警告:libverto-devel-0.2.5-2.nk.1.i686.rpm: Header V4 RSA/SHA1 Signature, key ID 34fe765a: NOKEY 391 准备中... ################################# [100%] 392 正在升级/安装... 393 1:libverto-devel-0.2.5-2.nk.1 ################################# [100%] 394 [root@localhost mysql]# rpm -ivh libcom_err-devel-1.42.7-2.nk.1.i686.rpm 395 警告:libcom_err-devel-1.42.7-2.nk.1.i686.rpm: Header V4 RSA/SHA1 Signature, key ID 34fe765a: NOKEY 396 准备中... ################################# [100%] 397 正在升级/安装... 398 1:libcom_err-devel-1.42.7-2.nk.1 ################################# [100%] 399 [root@localhost mysql]# rpm -ivh krb5-devel-1.11.3-1.nk.1.i686.rpm 400 警告:krb5-devel-1.11.3-1.nk.1.i686.rpm: Header V4 RSA/SHA1 Signature, key ID 34fe765a: NOKEY 401 准备中... ################################# [100%] 402 正在升级/安装... 403 1:krb5-devel-1.11.3-1.nk.1 ################################# [100%] 404 [root@localhost mysql]# rpm -ivh openssl-devel-1.0.1e-4.nk.1.i686.rpm 405 警告:openssl-devel-1.0.1e-4.nk.1.i686.rpm: Header V4 RSA/SHA1 Signature, key ID 34fe765a: NOKEY 406 准备中... ################################# [100%] 407 正在升级/安装... 408 1:openssl-devel-1:1.0.1e-4.nk.1 ################################# [100%] 409 [root@localhost mysql]# rpm -ivh mariadb-devel-5.5.39-1.nk.1.i686.rpm 410 警告:mariadb-devel-5.5.39-1.nk.1.i686.rpm: Header V4 RSA/SHA1 Signature, key ID 34fe765a: NOKEY 411 准备中... ################################# [100%] 412 正在升级/安装... 413 1:mariadb-devel-1:5.5.39-1.nk.1 ################################# [100%] 414 [root@localhost mysql]# rp 415 416 417 418 配置字符集 419 2、配置MariaDB的字符集 420 421 文件/etc/my.cnf 422 423 vi /etc/my.cnf 424 在[mysqld]标签下添加 425 426 init_connect='SET collation_connection = utf8_unicode_ci' 427 init_connect='SET NAMES utf8' 428 character-set-server=utf8 429 collation-server=utf8_unicode_ci 430 skip-character-set-client-handshake 431 文件/etc/my.cnf.d/client.cnf 432 433 vi /etc/my.cnf.d/client.cnf 434 在[client]中添加 435 436 default-character-set=utf8 437 文件/etc/my.cnf.d/mysql-clients.cnf 438 439 vi /etc/my.cnf.d/mysql-clients.cnf 440 在[mysql]中添加 441 442 default-character-set=utf8 443 全部配置完成,重启mariadb 444 445 systemctl restart mariadb 446 之后进入MariaDB查看字符集 447 448 [root@localhost ~]# mysql -u root -p 449 Enter password: 450 Welcome to the MariaDB monitor. Commands end with ; or \g. 451 Your MariaDB connection id is 14 452 Server version: 5.5.56-MariaDB MariaDB Server 453 454 Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others. 455 456 Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. 457 458 MariaDB [(none)]> show variables like "%character%";show variables like "%collation%"; 459 +--------------------------+----------------------------+ 460 | Variable_name | Value | 461 +--------------------------+----------------------------+ 462 | character_set_client | utf8 | 463 | character_set_connection | utf8 | 464 | character_set_database | latin1 | 465 | character_set_filesystem | binary | 466 | character_set_results | utf8 | 467 | character_set_server | latin1 | 468 | character_set_system | utf8 | 469 | character_sets_dir | /usr/share/mysql/charsets/ | 470 +--------------------------+----------------------------+ 471 8 rows in set (0.01 sec) 472 473 +----------------------+-------------------+ 474 | Variable_name | Value | 475 +----------------------+-------------------+ 476 | collation_connection | utf8_general_ci | 477 | collation_database | latin1_swedish_ci | 478 | collation_server | latin1_swedish_ci | 479 +----------------------+-------------------+ 480 3 rows in set (0.00 sec) 481 482 483 484 连接不上的问题 485 cd mysql安装目录\bin 486 mysql -u root -p123456; 487 mysql GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION; 488 mysql flush privileges; 489 490 491 492 493 494 495 496 7.安装完成后,启动mariadb服务端 497 498 systemctl start/stop/restart/status mariadb 499 systemctl enable mariadb 开机启动mariadb 500 501 8.mysql初始化 502 503 # 这条命令可以初始化mysql,删除匿名用户,设置root密码等等.... 504 mysql_secure_installation 505 506 9.设置mysql的中文编码支持,修改/etc/my.cnf 507 1.vi /etc/my.cnf 508 509 在[mysqld]中添加参数,使得mariadb服务端支持中文 510 [mysqld] 511 character-set-server=utf8 512 collation-server=utf8_general_ci 513 2.重启mariadb服务,读取my.cnf新配置 514 515 systemctl restart mariadb 516 3.登录数据库,查看字符编码 517 518 mysql -uroot -p 519 输入 \s 查看编码 520 521 10.mysql常用命令 522 523 复制代码 524 desc #查看表结构 525 create database #数据库名 526 create table #表名 527 查看如何创建db的 528 show create database #库名 529 # 查看如何创建table结构的 530 show create table 表名; 531 532 # 修改mysql的密码 533 set password = PASSWORD('redhat'); 534 535 # 创建mysql的普通用户,默认权限非常低 536 create user yining@'%' identified by 'yiningzhenshuai'; 537 538 # 查询mysql数据库中的用户信息 539 use mysql; 540 select host,user,password from user; 541 复制代码 542 543 11.给用户添加权限命令 544 545 复制代码 546 # 对所有库和所有表授权所有权限 547 grant all privileges on *.* to 账户@主机名 548 # 给yining用户授予所有权限 549 grant all privileges on *.* to yining@'%'; 550 # 刷新授权表 551 flush privileges; 552 复制代码 553 554 12.授予远程登录的权限命令(root不能远程登录的问题??) 555 556 复制代码 557 # 给apollo用户授予所有权限 558 grant all privileges on *.* to apollo@'%'; 559 # 给与root权限授予远程登录的命令 560 # 'centos这是密码随意设置 561 grant all privileges on *.* to root@'%' identified by 'centos'; 562 # 此时可以在windows登录linux的数据库 563 # 连接服务器的mysql 564 mysql -uyining -p -h 服务器的地址 565 复制代码 566 567 13.学习mysql的数据备份与恢复 568 569 复制代码 570 # 导出当前数据库的所有db,到一个文件中 571 1.mysqldump -u root -p --all-databases > /data/AllMysql.dump 572 2.登录mysql 导入数据 573 mysql -u root -p 574 > source /data/AllMysql.dump 575 3.通过命令导入数据 576 # 在登录时候,导入数据文件,一样可以写入数据 577 mysql -uroot -p < /data/AllMysql.dump 578 复制代码