标签:操作 node int test info 0 rows ati font linu
-rw-r--r-- 1 root root 28987588 Apr 9 01:06 mysql-community-client-8.0.11-1.el6.x86_64.rpm -rw-r--r-- 1 root root 672184 Apr 9 01:06 mysql-community-common-8.0.11-1.el6.x86_64.rpm -rw-r--r-- 1 root root 4443296 Apr 9 01:06 mysql-community-devel-8.0.11-1.el6.x86_64.rpm -rw-r--r-- 1 root root 2579460 Apr 9 01:06 mysql-community-libs-8.0.11-1.el6.x86_64.rpm -rw-r--r-- 1 root root 1902676 Apr 9 01:06 mysql-community-libs-compat-8.0.11-1.el6.x86_64.rpm -rw-r--r-- 1 root root 395918848 Apr 9 01:07 mysql-community-server-8.0.11-1.el6.x86_64.rpm -rw-r--r-- 1 root root 49092596 Apr 9 01:07 mysql-community-test-8.0.11-1.el6.x86_64.rpm
然后创建mysql用户:
useradd mysql passwd mysql
二、安装顺序为:(建议装之前先把之前的mysql相关包全部卸载,rpm -e --nodeps <包名>即可)
[root@python ~]# rpm -ivh mysql-community-common-8.0.11-1.el6.x86_64.rpm warning: mysql-community-common-8.0.11-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY Preparing... ########################################### [100%] 1:mysql-community-common ########################################### [100%] [root@python ~]# rpm -ivh mysql-community-libs-8.0.11-1.el6.x86_64.rpm warning: mysql-community-libs-8.0.11-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY Preparing... ########################################### [100%] 1:mysql-community-libs ########################################### [100%] [root@python ~]# rpm -ivh mysql-community-libs-compat-8.0.11-1.el6.x86_64.rpm warning: mysql-community-libs-compat-8.0.11-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY Preparing... ########################################### [100%] file /usr/lib64/mysql/libmysqlclient.so.16.0.0 from install of mysql-community-libs-compat-8.0.11-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.73-8.0.1.el6_8.x86_64 file /usr/lib64/mysql/libmysqlclient_r.so.16.0.0 from install of mysql-community-libs-compat-8.0.11-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.73-8.0.1.el6_8.x86_64 [root@python ~]# rpm -e --nodeps mysql-libs-5.1.73-8.0.1.el6_8.x86_64 [root@python ~]# rpm -ivh mysql-community-libs-compat-8.0.11-1.el6.x86_64.rpm warning: mysql-community-libs-compat-8.0.11-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY Preparing... ########################################### [100%] 1:mysql-community-libs-co########################################### [100%] [root@python ~]# rpm -ivh mysql-community-server-8.0.11-1.el6.x86_64.rpm warning: mysql-community-server-8.0.11-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY error: Failed dependencies: mysql-community-client(x86-64) >= 8.0.0 is needed by mysql-community-server-8.0.11-1.el6.x86_64 [root@python ~]# rpm -ivh mysql-community-client-8.0.11-1.el6.x86_64.rpm warning: mysql-community-client-8.0.11-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY Preparing... ########################################### [100%] 1:mysql-community-client ########################################### [100%] [root@python ~]# rpm -ivh mysql-community-server-8.0.11-1.el6.x86_64.rpm warning: mysql-community-server-8.0.11-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY Preparing... ########################################### [100%] 1:mysql-community-server ########################################### [100%] [root@python ~]# rpm -ivh mysql-community-devel-8.0.11-1.el6.x86_64.rpm warning: mysql-community-devel-8.0.11-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY Preparing... ########################################### [100%] 1:mysql-community-devel ########################################### [100%] ^[[A[root@python ~]# rpm -ivh mysql-community-test-8.0.11-1.el6.x86_64.rpm warning: mysql-community-test-8.0.11-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY error: Failed dependencies: perl(JSON) is needed by mysql-community-test-8.0.11-1.el6.x86_64 --懒的去装perl了,因此测试套件就不装了。
三、安装完毕后相关信息如下:
[root@python ~]# mysql -V mysql Ver 8.0.11 for Linux on x86_64 (MySQL Community Server - GPL) [root@python ~]# ll /etc/init.d/mysqld -rwxr-xr-x 1 root root 7166 Apr 8 16:21 /etc/init.d/mysqld [root@python ~]# ll /etc/my.cnf --配置文件位置 -rw-r--r-- 1 root root 1188 Apr 8 16:21 /etc/my.cnf
默认的datadir是在/var/lib/mysql/,可以通过修改my.cnf修改,启动命令如下:
[root@python ~]# service mysqld start Initializing MySQL database: [ OK ] Starting mysqld: [ OK ]
四、发现没密码不能登录,于是添加skip-grant-tables到my.cnf,重启进去重置密码
mysql> alter user root@‘localhost‘ identified by ‘mysql‘; ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement mysql> exit Bye
居然不能改。。。于是:
mysql> delete from mysql.user where user=‘root‘; Query OK, 1 row affected (0.10 sec) mysql> flush privileges; Query OK, 0 rows affected (0.00 sec)
mysql> create user root@‘localhost‘ identified by ‘mysql‘; ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
还是不能改,查看密码复杂度要求:
mysql> show variables like ‘%pass%‘; +----------------------------------------------+-----------------+ | Variable_name | Value | +----------------------------------------------+-----------------+ | caching_sha2_password_auto_generate_rsa_keys | ON | | caching_sha2_password_private_key_path | private_key.pem | | caching_sha2_password_public_key_path | public_key.pem | | default_password_lifetime | 0 | | disconnect_on_expired_password | ON | | mysql_native_password_proxy_users | OFF | | password_history | 0 | | password_reuse_interval | 0 | | report_password | | | sha256_password_auto_generate_rsa_keys | ON | | sha256_password_private_key_path | private_key.pem | | sha256_password_proxy_users | OFF | | sha256_password_public_key_path | public_key.pem | | validate_password.check_user_name | ON | | validate_password.dictionary_file | | | validate_password.length | 8 | | validate_password.mixed_case_count | 1 | | validate_password.number_count | 1 | | validate_password.policy | MEDIUM | | validate_password.special_char_count | 1 | +----------------------------------------------+-----------------+
于是设置为0,然后将validate_password.length设置为4,表示最少需要4字符。之所以设置为4是因为这个参数的值不能小于如下公式的计算结果:
validate_password.number_count + validate_password.special_char_count + (2 * validate_password.mixed_case_count)
于是继续创建用户,MySQL8.0取消了直接grant创建用户的语法,只能先create user再grant,因此创建root如下:
mysql> create user root@‘localhost‘ identified by ‘mysql‘; ERROR 1396 (HY000): Operation CREATE USER failed for ‘root‘@‘localhost‘ mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.00 sec) mysql> create user root@‘localhost‘ identified by ‘mysql‘; ERROR 1396 (HY000): Operation CREATE USER failed for ‘root‘@‘localhost‘
mysql> drop user root@‘localhost‘; --是的没错,虽然没有root@‘localhost‘用户,但你还是要删一遍。 Query OK, 0 rows affected (0.05 sec) mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.01 sec) mysql> create user root@‘localhost‘ identified by ‘mysql‘; Query OK, 0 rows affected (0.03 sec) mysql> grant all on *.* to root@‘localhost‘ with grant option; Query OK, 0 rows affected (0.03 sec)
终于改完密码了...去掉参数文件的skip-grant-tables参数,service mysqld restart重启服务。
标签:操作 node int test info 0 rows ati font linu
原文地址:https://www.cnblogs.com/leohahah/p/9044904.html