Thanx @RolandoMySQLDBA and @dgw for help! ;)
in meantime i created certificates again, validated them, then i re-installed all MySQL products on computer, added new user with this:
GRANT ALL PRIVILEGES ON *.* TO 'ssluser'@'localhost' IDENTIFIED BY 'ssluser' REQUIRE SSL;
and after loging like this:
mysql -ussluser -pssluser -P3306 --ssl-key=
it works :D.
But i got another problem - how to connect to MySQL using SSL, via servlet? Without SSL code that worked looked like this:
package test;
import java.io.*;
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class Registration extends HttpServlet{
/**
*
*/
private static final long serialVersionUID = 1L;
public void init(ServletConfig config) throws ServletException{
super.init(config);
}
public void doPost(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException{
String connectionURL = "jdbc:mysql://localhost:3306/jsp";
Connection connection=null;
ResultSet rs;
res.setContentType("text/html");
PrintWriter out = res.getWriter();
String firstNamed = req.getParameter("firstName");
String lastNamed = req.getParameter("lastName");
String emaild = req.getParameter("email");
String userNamed = req.getParameter("userName");
String password1d = req.getParameter("password1");
String zipd = req.getParameter("zip");
String auto = "user";
try {
Class.forName("org.gjt.mm.mysql.Driver");
connection = DriverManager.getConnection(connectionURL, "root", "root");
String sql = "insert into userprofile values (?,?,?,?,?,?,?)";
PreparedStatement pst = connection.prepareStatement(sql);
pst.setString(1, firstNamed);
pst.setString(2, lastNamed);
pst.setString(3, emaild);
pst.setString(4,userNamed);
pst.setString(5, password1d);
pst.setString(6, zipd);
pst.setString(7, auto);
int numRowsChanged = pst.executeUpdate();
out.println(" Welcome : ");
out.println(" '"+userNamed+"'");
pst.close();
}
catch(ClassNotFoundException e){
out.println("Couldn't load database driver: " + e.getMessage());
}
catch(SQLException e){
out.println("SQLException caught: " + e.getMessage());
}
catch (Exception e){
out.println(e);
}
finally {
try {
if (connection != null) connection.close();
}
catch (SQLException ignored){
out.println(ignored);
}
}
}
}
just, how correct it? i quess that i need to modify connectionURL somehow but i dont know how :(