Forget MySQL Root Password
1. Stop the mysql service
>/etc/init.d/mysql stop
2. Start the server without password
>mysqld_safe --skip-grant-tables &
3. connect to the mysql server
>mysql -u root
4. setup new MYSQL root user password
>use mysql;
>update user set password=PASSWORD("CHANGE ME") where User = 'root';
>fulsh privileges;
>quit
5. Restart the Server
>/etc/init.d/mysql stop
>/etc/init.d/mysql start
6. Test the result
>mysql -u root -pChangeMe
7. Create a schema and grant the privileges to a user
>show databases;
>create database reviewboard;
>use mysql;
>grant all privileges on reviewboard.* to reviewboard@"%" identified by 'reviewboard';
>flush privileges;
references:
http://www.debian-administration.org/articles/442
http://www.cyberciti.biz/tips/recover-mysql-root-password.html
http://sillycat.iteye.com/blog/562672
分享到:
相关推荐
mysql> alter user 'root'@'localhost' identified with mysql_native_password by '12345678'; mysql> flush privileges; 如上即可。 加入环境变量,编辑 /etc/profile,这样可以在任何地方用mysql命令了 sudo...
jdbc连接mysql驱动包(mysql-connector-java-8.0.16.jar和mysql-connector-java-5.1.47.jar)。在java程序中使用JDBC,Class....useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=UTC","root","password");
connection= DriverManager.getConnection("jdbc:mysql://192.168.1.99:3306/root","root","root"); String sql="select * from user";//查询表中的所有内容 Statement statement=connection.createStatement();/...
java连接mysql代码 和驱动包 package com.wen.Money; import java.sql.DriverManager; import java.sql.SQLException;... Class.forName("com.mysql.jdbc.Driver").newInstance(); Connection conn=null;
2 安装 MySQL 5输入命令:apt-get install mysql-server mysql-client安装过程中需要设置root账户密码,系统会作以下提示:New password for the MySQL ”root” user:Repeat password for theMySQL ”root” user: ...
在C:\Program Files\Java目录下建立mysqlforjdbc子目录,进入该目录将mysql-connector-java-5.1.30-bin.jar到该目录下 进入C:\Program Files\Java\jdk1.7.0_04\lib目录将mysql-connector-java-5.1.30-bin-g.jar拷贝...
mysql-connector-java-5.1.48 最新mysql-connector-java,自行导入IDE中使用 Class.forName("com.mysql.cj.jdbc.Driver"); conn = DriverManager.get...useSSL=false&serverTimezone=UTC","root","password");
eclipes中的jdbc包,利用此包可以连接mysql数据库,代码如下: ...user=root&password=admin&userUnicode=true&characterEncoding=gb2312"; Connection conn=DriverManager.getConnection(url);
mysql> update user set password = password("wppassword") where User = 'wpuser'; Query OK, 1 row affected (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> GRANT ALL PRIVILEGES ON wordpress.* ...
mysql> update user set password = password("wppassword") where User = 'wpuser'; Query OK, 1 row affected (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> GRANT ALL PRIVILEGES ON wordpress...
static { try { Class.forName("com.mysql.jdbc.Driver"); conn = DriverManager.getConnection(URL, USER, PASSWORD); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (SQLException e) { e....
Class.forName("org.gjt.mm.mysql.Driver"); } catch(java.lang.ClassNotFoundException e11) { System.out.println("Class not found exception occir.Message is:"); System.out.println(e11...
1 Class.forName("com.mysql.jdbc.Driver"); 2 String url ="jdbc:mysql://localhost:3306/database0212"; 3 String uername = "root"; 4 String password = "123456"; conn = DriverManager.getConnection(url...
user=root&password=admin&useUnicode=true&characterEncoding=UTF-8"); Statement st=conn.createStatement(); ResultSet rs=st.executeQuery("select * from user"); DocumentBuilderFactory factory=...
con1 = mysql_real_connect(con1,IPAddress,UserName,Password, NULL, Port, NULL, 0); if(!con1) { printf("no con"); } else { printf("con..."); } con1->reconnect = 1; mysql_select_db(con1, ...
con = DriverManager.getConnection( "jdbc:mysql://localhost:3306/test2","root","root"); 连接oracle classes12.jar Class.forName( "oracle.jdbc.driver.OracleDriver" ); con = DriverManager.get...
user=root&password=root"; // 定义驱动数据库的类 String driver = "org.gjt.mm.mysql.Driver"; // 定义连接数据库对象conn Connection conn = null; // 定义执行sql语句对象stmt Statement stmt = ...
Connection connection = DriverManager.getConnection(url, user, password); Statement stmt= connection.createStatement(); String sql="select * from sa"; ResultSet rs=stmt.executeQuery(sql); if(rs....
user=root&password;="; conn = DriverManager.getConnection(url); System.out.println("connect ok"); } public static void main(String[] args) { try { new DatabaseConnect(); } catch ...
conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/users", "root", "123456"); // 获取表达式对象实例 stmt = conn.createStatement(); rs=stmt.executeQuery("select * from user where ...