一、mysql的root密码忘记,进行修改
1、vim /etc/my.cnf 进入后添加 skip-grant-tables 免密码登录
2、/etc/init.d/mysqld restart 重启mysql服务
#service mysqld start (5.0版本是mysqld)
# service mysql start (5.5.7版本是mysql)
使用 mysqld 脚本启动:
/etc/inint.d/mysqld start
3、mysql -uroot -P3306 直接进入数据库
4、修改密码:
use mysql;选择mysql库
根据mysql的版本不同,看mysql的user表字段是password还是authentication_string,然后根据字段进行密码修改
update user set password=password("你的新密码") where user="root";
update mysql.user set authentication_string=password('*******') where user='*******'; #修改密码成功
flush privileges;使修改立即生效
5、修改访问的地址
%允许任何地址访问,也可以设置固定地址访问
update mysql.user set Host=’%’ where Host=’localhost’ and user='root';
flush privileges;使修改立即生效
6、创建用户
CREATE USER shht_test IDENTIFIED BY 'shht_test';
grant all on shht_test.* to 'shht_test';##把数据库shht_test的所有权限给shht_test
revoke all on shht_test.* from 'shht_test';##把数据库shht_test的所有权限从shht_test收回
flush privileges;
7、mysqldump无法运行命令
find / -name mysql -print
ln -fs /usr/local/mysql/bin/mysqldump /usr/bin
8、mysqldump
mysqldump -h数据库地址 -u用户名 -p密码 导出的数据库 >data.sql
mysql -h目标数据库地址 -u用户名 -p密码 目标库<data.sql
二、查看linux上安装的程序并找到相关的文件的安装路径
[root@ora11g usr]# which python3 #查看python3的应用位置
/usr/local/bin/python3
[root@ora11g usr]# ll /usr/local/bin/python3 #查看应用有软连接,找到实际应用文件的位置
lrwxrwxrwx 1 root root 32 4月 30 11:01 /usr/local/bin/python3 -> /usr/local/python3/bin/python3.5