Hot questions for Using Ubuntu in mysql


package practice;

import java.sql.*;
import java.util.Properties;

public class DBTEst

  private static final String dbClassName = "com.mysql.jdbc.Driver";

  private static final String CONNECTION =

  public static void main(String[] args) throws

      Properties p = new Properties();

    Connection c = DriverManager.getConnection(CONNECTION,p);

    System.out.println("It works !");

i am new to database and so to sql.. i just configured the mysql with eclipse in ubuntu OS. but when i am trying to run the program i am getting the error like below.

Exception in thread "main" java.sql.SQLException: Access denied for user 'paulr'@'localhost' (using password: YES)
    at com.mysql.jdbc.SQLError.createSQLException(
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(
    at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(
    at com.mysql.jdbc.MysqlIO.doHandshake(
    at com.mysql.jdbc.ConnectionImpl.coreConnect(
    at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(
    at com.mysql.jdbc.ConnectionImpl.createNewIO(
    at com.mysql.jdbc.ConnectionImpl.<init>(
    at com.mysql.jdbc.JDBC4Connection.<init>(
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(
    at java.lang.reflect.Constructor.newInstance(
    at com.mysql.jdbc.Util.handleNewInstance(
    at com.mysql.jdbc.ConnectionImpl.getInstance(
    at com.mysql.jdbc.NonRegisteringDriver.connect(
    at java.sql.DriverManager.getConnection(
    at java.sql.DriverManager.getConnection(
    at practice.DBTEst.main(

i have found the same question in the forum but didn't solved my issue ...may it's due to OS change if not that pls forgive my ignorance and please guide through this..thanks for your help...root password i've set while installing mySQL is "welcome"..


Either you did not set up the user paulr correctly in MySQL when you set it up, or you might have made the common mistake of overlooking that fact that MySQL does account access based on the client's IP address or hostname. Many people forget to include localhost and/or in the user setup.



I am developing a JSP, Servlet (pure jsp and servlet) application with hibernate.

I know that in "most" linux systems, the MySQL table names and database names are case sensitive, while in windows and Apple it is the other way around. I just learnt this in the hard way, ended up replacing table names in database and my java code.

However I can only test in Ubuntu. I do have "column" names with mixed cases. For an example, some columns of the table "employee" are idEmployee, FirstName, LastName, HomeAddress, PhoneNumberetc.

I know ubuntu is not making trouble with the case sensitivity of table "column" names, but what about other linux systems? Is there any linux/unix OS where it is case sensitive for the "column names" ?


I don't think you have to worry. The documentation is clear that column aliases are not case sensitive:

Column, index, stored routine, and event names are not case sensitive on any platform, nor are column aliases.

. . .

By default, table aliases are case sensitive on Unix, but not so on Windows or OS X.

If I had to speculate why the case sensitivity follows the default case sensitivity of the underlying operating system, I would guess that under some circumstances (particularly long ago when MySQL was being developed), tables are stored in files under their own names. Now it is controlled by the lower_case_table_names system variable, which simply has different defaults on different operating systems.


Using Ubuntu 15.04, Eclipse Mars and JDBC MySQL Connector. Testing a Web Service (Maven project) that, upon deployment, builds several databases and tables. On first test, built just fine - thus, no code posted because there are no errors of syntax.

Before second test, however, I deleted all db directories under /var/lib/mysql. On running second test, Eclipse gives me an error stating that my tables can't be created because they already exist. Tried forcing reload of /etc/init.d/mysql, clearing query cache, as well as "DROP TABLE IF EXISTStable;" before issuing the CREATE TABLE query. What am I doing wrong?


I deleted all db directories under /var/lib/mysql.

Don't do that.

The correct way to remove a database is to DROP DATABASE foo;. Tinkering with the files in /var/lib/mysql requires that you Know Exactly What You're Doing™.

What you have probably done is left tables stranded in the data dictionary.

What you probably can do is recreate the database manually with CREATE DATABASE foo; then try dropping it. Failing that, you may need to (from the shell, not from mysql) sudo mkdir /var/lib/mysql/foo then sudo chown -R mysql:mysql /var/lib/mysql/foo and then try DROP DATABASE foo;. Failing that, restart the server and see if it is any happier after that if you try to drop the database once again.

Note that if you are not using the MySQL command line client, you should run the query SHOW WARNINGS; after each query above -- some clients do not tell you when warnings occur and they can contain useful troubleshooting info.

Also, SELECT @@ERROR_LOG;. Read the log file on your server at the path indicated.


I was working on a small project (mostly for fun) on java with Eclipse Neon (and window builder), in which I had to connect to MySQL and retrieve certain info. In windows it worked great, I was able to connect, get the info, etc. But then I switched to Linux Ubuntu 16.04 and it just won't connect to MySQL. I already have the connector's path built and all that. I have no idea on what's happening or how to fix it, since I'm quite new to java programming (or programming in general) and haven't read any books about it. Below I'll leave some of the code (at least what I think is important).


import java.awt.EventQueue;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;

public class Test extends JFrame {

    Connection Con;
    Statement Sent;

    private JPanel contentPane;

    public static void main(String[] args) {
        EventQueue.invokeLater(new Runnable() {
            public void run() {
                try {
                    Test frame = new Test();
                } catch (Exception e) {
        try {
            Connection con = DriverManager.getConnection("jdbc:mysql://" + "user=root&password=PanXo_666");
                Statement st = con.createStatement();
                ResultSet result = st.executeQuery("select * from Proyectos");

                while ( {


        } catch (ClassNotFoundException e) {
            System.out.println("Driver not found");
        } catch (SQLException e) {


    public Test() {
        setBounds(100, 100, 450, 300);
        contentPane = new JPanel();
        contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));

    void PrepararBaseDatos() {
        try {
            String controlador = "com.mysql.jdbc.Driver";
            String servidor = "jdbc:mysql://localhost/BDConductores/";
            String usuarioDB = "root";
            String passwordDB = "PanXo_666";

            Con = DriverManager.getConnection(servidor, usuarioDB, passwordDB);
        } catch (Exception e) {
            JOptionPane.showMessageDialog(null, "Error al cargar controlador");
        try {
            Sent = Con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
        } catch (Exception e) {
            JOptionPane.showMessageDialog(null, "Error al cargar controlador");

and there's no error message, (besides the one in the code) it just won't load the controller and i have no idea what happens :c


at the end I was able to see what was wrong... I wrote the wrong server name. it wasn't like this:

String servidor = "jdbc:mysql://localhost/BDConductores/";

it was like this:

String servidor = "jdbc:mysql://";

So now my program connects to my database with no problems