Ubuntu MySQL配置管理員密碼
Ubuntu mysql是常用的開發系統,于是我學習研究了設置root密碼進入Ubuntu mysql,在這里對大家詳細介紹下設置root密碼進入Ubuntu mysql系統應用,希望對大家有用。
設置root密碼進入mysql
root@zack-desktop:~# sudo mysql -u root -pEnter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 45
Server version: 5.1.37-1ubuntu5 (Ubuntu)
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
配置 Ubuntu MySQL 的管理員密碼:
mysql> sudo mysqladmin -u root password newpassword或mysql> GRANT ALL PRIVILEGES ON *.* TO root@localhost IDENTIFIED BY "password01!";Query OK, 0 rows affected (0.00 sec)
修改配置文件允許遠程訪問或控制
1新建一個測試用的數據庫
mysql> create database test;
Query OK, 1 row affected (0.00 sec)
2 給數據庫添加test_root管理員用戶
mysql> GRANT ALL PRIVILEGES ON test.* TO test_root@"%" IDENTIFIED BY "123456";
Query OK, 0 rows affected (0.14 sec)
3打開配制文件
$sudo gedit /etc/mysql/my.cnf
my.conf
老的版本中 >skip-networking => # skip-networking 新的版本中 >bind-address=127.0.0.1 => bind-address= 你機器的IP
【編輯推薦】