1.删data
2.初始化
3.找err
yq@gyq-virtual-machine:~$ mysql -u root -p Enter password: ERROR 1698 (28000): Access denied for user 'root'@'localhost'
加上这一句
gyq@gyq-virtual-machine:~$ sudo mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 13 Server version: 8.0.28-0ubuntu0.20.04.3 (Ubuntu) Copyright (c) 2000, 2022, Oracle and/or its affiliates. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | sys | +--------------------+ 4 rows in set (0.03 sec) mysql>
8版本密码不知道的话
mysql -u root -p
设置密码:
set password for 'root'@'localhost'='123';
寻找虚拟机的mysql的安装路径
2022-04-14 09:22:27 INFO StateStoreCoordinatorRef:54 - Registered StateStoreCoordinator endpoint Exception in thread "main" java.sql.SQLException: Access denied for user 'root'@'localhost' at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129) at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122) at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:829) at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:449) at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:242) at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:198) at org.apache.spark.sql.execution.datasources.jdbc.JdbcUtils anonfun$createConnectionFactory$1.apply(JdbcUtils.scala:63)atorg.apache.spark.sql.execution.datasources.jdbc.JdbcUtils anonfun$createConnectionFactory$1.apply(JdbcUtils.scala:63)atorg.apache.spark.sql.execution.datasources.jdbc.JdbcUtils anonfun$createConnectionFactory$1.apply(JdbcUtils.scala:54) at org.apache.spark.sql.execution.datasources.jdbc.JDBCRDD$.resolveTable(JDBCRDD.scala:56) at org.apache.spark.sql.execution.datasources.jdbc.JDBCRelation.<init>(JDBCRelation.scala:115) at org.apache.spark.sql.execution.datasources.jdbc.JdbcRelationProvider.createRelation(JdbcRelationProvider.scala:52) at
这个是密码账号不对,自己改
update user set authentication string='' where user= 'root'; ALTER user 'root' @'localhost' IDENTIFIED BY‘123456'; ALTER USER 'root'@'localhost' IDENTIFIED BY 'QQ3154067760!!!'; use mysql; ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456'; flush privileges; quit; update user set authentication_string='' where user='root'; mysql> flush privileges ; mysql>quit 2022-04-14T05:34:48.181552Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: <%2qvHuBt7Bu MySQL修改初始密码三种方法: 方法一: 1、使用空的初始密码登录mysql账号: mysql-uroot -p 2、修改root密码: SETPASSWORD = PASSWORD('123456'); 方法二: 1、使用空的初始密码登录mysql账号: mysql-uroot -p 2、修改root密码: mysqladmin -u root password '123456' 方法三: 1、使用空的初始密码登录mysql账号: mysql-uroot -p 2、修改root密码: mysql> update user set Password=password("123456") where User='root'; Query OK, 4 rows affected (0.01 sec) Rows matched: 4 Changed: 4 Warnings: 0 mysql> flush privileges; Query OK, 0 rows affected (0.04 sec) mysql> select Host,User,password from user where user='root'; +-----------------------+------+-------------------------------------------+ | Host | User | password | +-----------------------+------+-------------------------------------------+ | localhost | root | *5626ED34B75C6C508BA2A3D0A4F6E4C58823138C | | localhost.localdomain | root | *5626ED34B75C6C508BA2A3D0A4F6E4C58823138C | | 127.0.0.1 | root | *5626ED34B75C6C508BA2A3D0A4F6E4C58823138C | | ::1 | root | *5626ED34B75C6C508BA2A3D0A4F6E4C58823138C | +-----------------------+------+-------------------------------------------+ 4 rows in set (0.00 sec) mysql 5.7的数据库没有了password字段,用的是authentication_string字段: mysql> update mysql.user set authentication_string=password('root') where user='root' ; mysql> flush privileges; mysql 8.0.13的数据库用的也是authentication_string字段: mysql> update mysql.user set authentication_string='******' where user='root' ; mysql> flush privileges; 参考: https://www.cnblogs.com/jimmyTang-J/p/9698211.html https://blog.csdn.net/xuheng8600/article/details/80034647 https://blog.csdn.net/z13615480737/article/details/78907697 ====================================================================== 1页 初始密码为空,使用空密码登陆mysql执行下列语句 mysql>use mysql; mysql> UPDATE user SET password=PASSWORD(root) WHERE user='root'; mysql> FLUSH PRIVILEGES; mysql> quit; 修改/opt/lampp/phpmyadmin/config.inc.php 找到如下代码: $cfg['Servers'][$i]['auth_type'] = 'config'; $cfg['Servers'][$i]['user'] = 'root'; $cfg['Servers'][$i]================================================================== update user set authentication_string=PASSWORD('123456') where user='root';我个 gyq@gyq-virtual-machine:/etc/mysql$ cat debian.cnf cat: debian.cnf: 权限不够 gyq@gyq-virtual-machine:/etc/mysql$ sudo cat debian.cnf [sudo] gyq 的密码: # Automatically generated for Debian scripts. DO NOT TOUCH! [client] host = localhost user = debian-sys-maint password = dOv1YXqIEXueQbJL socket = /var/run/mysqld/mysqld.sock [mysql_upgrade] host = localhost user = debian-sys-maint password = dOv1YXqIEXueQbJL socket = /var/run/mysqld/mysqld.sock gyq@gyq-virtual-machine:/etc/mysql$ mysql -uroot -p Enter password: ERROR 1698 (28000): Access denied for user 'root'@'localhost' gyq@gyq-virtual-machine:/etc/mysql$ mysql -u debian-sys-maint -p dOv1YXqIEXueQbJL Enter password: ERROR 1049 (42000): Unknown database 'dOv1YXqIEXueQbJL' gyq@gyq-virtual-machine:/etc/mysql$ mysql -u debian-sys-maint -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 13 Server version: 8.0.28-0ubuntu0.20.04.3 (Ubuntu) Copyright (c) 2000, 2022, Oracle and/or its affiliates. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. 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> update user set authentication_string=PASSWORD("123456") where user='root'; ERROR 1064 (42000): You have an error in your ----------------------------------------------------------------------------------------------------------------------------- 第一步:进入目录:cd /etc/mysql,查看debian.cnf文件第二步:使用上图中的账号密码登录MySQL。第三步:查看数据库中的库。 第四步:使用mysql库。 第五步:使用一下语句设置账号密码:update user set authentication_string=PASSWORD("自定义新密码") where user='root';我个人设置的简单。账号为:root。 密码:123456.第六步:执行一下语句:update user set plugin="mysql_native_password";第七步:刷新:flush privileges;第八步:退出:quit;第九步:修改密码完成。 在命令框中输入:/etc/init.d/mysql restart; 重启MySQL ------------------------------------————————————————————————————————————————————————————————————+++ create table user_test ( name varchar(64), age int(11) ) CREATE TABLE St( bname CHAR(10) PRIMARY KEY, number CHAR(10) );