国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 數據庫 > MySQL > 正文

mysql設置更改root密碼、mysql服務器的連接、mysql常用命令的圖解

2024-07-24 12:50:09
字體:
來源:轉載
供稿:網友

1、設置更改root密碼

查看mysql 啟動與否,若沒啟動就運行:/usr/local/mysql56/bin/mysql

ps aux |grep mysql 或 netstat -tulnp |grep 3306

運行mysql 命令,會出現:

-bash: mysql: command not found

就把mysql 添加到環境變量:

臨時添加:PAHT=$PATH:/usr/local/mysql56/bin

永久添加:echo "export PATH=$PATH:/usr/local/mysql56/bin" >>/etc/profile

再運行soucre /etc/profile 或 . /etc/profile


mysql密碼的設置,給root用戶設置密碼

mysql -uroot password 'new_password' 或用下面的方式

如何修改密碼:

mysqladmin -uroot -p 'old_password' password 'new_password' 或用下面的方式


忘記密碼了如何修改:

首先,得修改配制文件:vim /etc/my.cnf

在[mysqld]模塊下加入skip-grant ,然后重啟mysql服務:sed -i '/3306/a/skip-grant' /etc/my.cnf

重啟:/etc/init.d/mysqld restart


然后,切換數據庫:use mysql;

然后,再在數據庫里面修改root密碼:update user set password=password('new_password') where user='root';

這樣就把密碼給改回來了


重新測試,就把my.cnf給改回來:


2、mysql的連接

mysql -uroot -p'password'mysql -h127.0.0.1 -uroot -p'password'mysql -S/tmp/mysql.sock -uroot -p'password'mysql -uroot -p -e "show databases"


3、mysql常用命令

查詢有多少庫:show databases;

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 乌拉特前旗| 阜城县| 白朗县| 临邑县| 册亨县| 虎林市| 潢川县| 桃江县| 巴彦淖尔市| 漯河市| 榆社县| 宁海县| 彰武县| 安徽省| 余干县| 铜山县| 泰安市| 清镇市| 宁南县| 蓬安县| 建水县| 仁寿县| 灵石县| 胶州市| 邛崃市| 凤凰县| 彭阳县| 灌云县| 东源县| 西安市| 阿拉善盟| 平果县| 宁强县| 高州市| 兴义市| 菏泽市| 女性| 洪雅县| 张家川| 荥阳市| 沭阳县|