简体   繁体   English

java.sql.SQLException:在 ZE84E30B9390CDB64ZZ6DB2C9AB8784D 中的用户“root”@“192.148.2.106”(使用密码:YES)的访问被拒绝

[英]java.sql.SQLException: Access denied for user 'root'@'192.148.2.106' (using password: YES) in Android

i'm trying to connect my android app to mysql database with JDBC, but i keep getting this exception when i test the app in a real device and i really can't figure it out i have tried to create a new user in XAMPP and granting all privileges to the user, but none of that worked out i'm trying to connect my android app to mysql database with JDBC, but i keep getting this exception when i test the app in a real device and i really can't figure it out i have tried to create a new user in XAMPP and授予用户所有权限,但没有一个成功

could somebody help me with that please, i'm really blocked?有人可以帮我吗,我真的被阻止了吗?

My activity code:我的活动代码:

public class SuccessActivity extends AppCompatActivity {
    public static final String url="jdbc:mysql://192.148.2.114:3306/gtransport";
    public static final String user="root";
    public static final String pass="a123";
    TextView EmailShow;
    TextView Etat;
    String EmailHolder;


    @Override
    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_success);


        EmailShow = (TextView)findViewById(R.id.email_textview);
        Etat=(TextView)findViewById(R.id.etat_textview);


        Intent intent = getIntent();
        EmailHolder = intent.getStringExtra(MainActivity.USER_NAME);
        EmailShow.setText(EmailHolder);
        new MyTask().execute();


    }
    private class MyTask extends AsyncTask<Void,Void,Void>{
        private  String V_etat="";



        @Override
        protected Void doInBackground(Void... voids) {

            try{
                Class.forName("com.mysql.jdbc.Driver");

                Connection con= DriverManager.getConnection(url,user,pass);
                String sql="select * from Chauffeur where email=?";

                PreparedStatement stmt=con.prepareStatement(sql);
                stmt.setString(1,EmailHolder);

                ResultSet rs=stmt.executeQuery();

                while(rs.next()) {

                    V_etat = (rs.getString("nom"));

                }
            }
            catch(Exception e){
                e.printStackTrace();
            }






            return null;
        }

        @Override
        protected void onPostExecute(Void aVoid) {
            Etat.setText(V_etat);
            super.onPostExecute(aVoid);
        }
    }




}

here's my users table in xampp:这是我在 xampp 中的用户表: 在此处输入图像描述

i resolved my problem, i figured out that when i was creating the user i typed the password by myself.and at the same time i forgot and clicked on "generate password button" which generates an automatic password for u .我解决了我的问题,我发现当我创建用户时,我自己输入了密码。同时我忘记并点击了“生成密码按钮”,它会为你生成一个自动密码。

so anyone who is facing similar problem pay attention to that while creating a new user !所以任何面临类似问题的人在创建新用户时都要注意这一点!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 当我尝试远程访问mysql时,拒绝用户&#39;root&#39;@&#39;localhost&#39;的访问(使用密码:是) - Access denied for user 'root'@'localhost' (using password: YES) when i try accessing mysql remotely java.sql.sqlexception网络错误ioexception权限被拒绝 - java.sql.sqlexception network error ioexception permission denied Android:java.sql.SQLException:结果集中没有当前行 - Android :java.sql.SQLException: No current row in the ResultSet java.sql.SQLException:android studio中无效的对象名称“ tablename” - java.sql.SQLException: Invalid object name 'tablename' in android studio Android java.sql.SQLException:没有合适的驱动程序Postgress数据库查询 - Android java.sql.SQLException: No suitable driver Postgress database query java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/mydatabase Android Studio Java MySQL - java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/mydatabase Android Studio Java MySQL java.sql.SQLException:单点登录仅在Windows上受支持。 请指定用户名 - java.sql.SQLException: Single-Sign-On is only supported on Windows. Please specify a user name Android Java接收root访问被拒绝 - android java receive root access is denied java.sql.SQLException:与Postgres交互的android应用程序中没有适当的驱动程序错误 - java.sql.SQLException: No Suitable Driver error in android app that interacts with postgres 使用ORMLite配置文件:java.sql.SQLException:可序列化的字段必须指定dataType = DataType.SERIALIZABLE - Using ORMLite config file: java.sql.SQLException: Serializable fields must specify dataType=DataType.SERIALIZABLE
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM