MySQL 更改数据库密码

举报
jscsd226 发表于 2019/08/09 22:13:56 2019/08/09
【摘要】 环境:CentOS 6.5 64bitmysql-server版本:5.1.73【需求】If it is necessary you can change the admin password in MySQL:update administratorssetpass=MD5('new password')where login='admin';【更改方法】1)登陆mysql [roo...

环境:CentOS 6.5 64bit

mysql-server版本:5.1.73


【需求】

If it is necessary you can change the admin password in MySQL:

update administratorssetpass=MD5('new password')where login='admin';



【更改方法】

1)登陆mysql

    [root@szdev03 conf]# mysql -u root -p
    Enter password:
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 29
    Server version: 5.1.73 Source distribution
     
    Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
     
    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.
     
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
     
    mysql>


2)显示数据库

    mysql> show databases;
    +--------------------+
    | Database           |
    +--------------------+
    | information_schema |
    | mysql              |
    | stalker_db         |
    | test               |
    +--------------------+
    4 rows in set (0.00 sec)
     
    mysql>


3)选择数据库

    mysql> use stalker_db
    Database changed


4)显示指定数据库的所有表

    mysql> show tables;
    +----------------------------+
    | Tables_in_stalker_db       |
    +----------------------------+
    | access_tokens              |
    | acl                        |
    | adm_grp_action_access      |
    | admin_dropdown_attributes  |
    | admin_groups               |
    | administrators             |
    | album                      |
    | all_cities                 |
    | anec                       |
    | anec_bookmark              |
    | anec_rating                |
    | api_storage                |
    | apps                       |
    | apps_tos                   |
    | audio                      |
    | audio_albums               |
    | audio_compositions         |
    | audio_genre                |
    | audio_genres               |
    | audio_languages            |
    | audio_performers           |
    | audio_playlist_tracks      |
    | audio_playlists            |
    | audio_years                |
    | cat_genre                  |
    | censored_channels          |
    | ch_link_on_streamer        |
    | ch_links                   |
    | changelog                  |
    | cities                     |
    | clients                    |
    | countries                  |
    | countries_in_zone          |
    | course_cache               |
    | daily_media_claims         |
    | daily_played_video         |
    | deleted_channels           |
    | developer_api_key          |
    | diagnostic_info            |
    | download_links             |
    | dvb_channels               |
    | epg                        |
    | epg_setting                |
    | events                     |
    | ext_adv_campaigns          |
    | ext_adv_campaigns_position |
    | ext_adv_positions          |
    | ext_adv_sources            |
    | fav_itv                    |
    | fav_karaoke                |
    | fav_radio                  |
    | fav_recipes                |
    | fav_vclub                  |
    | filter_set                 |
    | filters                    |
    | gapi_cache_cur_weather     |
    | generation_time            |
    | genre                      |
    | gismeteo_day_weather       |
    | github_api_cache           |
    | help_city_info             |
    | image_update_settings      |
    | itv                        |
    | itv_subscription           |
    | karaoke                    |
    | karaoke_archive            |
    | karaoke_genre              |
    | languages                  |
    | last_id                    |
    | launcher_apps              |
    | loading_fail               |
    | main_city_info             |
    | master_log                 |
    | mastermind_wins            |
    | media_category             |
    | media_claims               |
    | media_claims_log           |
    | media_favorites            |
    | messages_templates         |
    | moderator_tasks            |
    | moderators                 |
    | moderators_history         |
    | notification_feed          |
    | openweathermap_cache       |
    | other_city_info            |
    | package_in_plan            |
    | package_subscribe_log      |
    | permitted_video            |
    | playback_sessions          |
    | played_itv                 |
    | played_timeshift           |
    | played_tv_archive          |
    | played_video               |
    | playlist                   |
    | playlist_members           |
    | playlists                  |
    | pvr                        |
    | pvr_storages               |
    | quality                    |
    | radio                      |
    | readed_anec                |
    | rec_files                  |
    | recipe_cats                |
    | recipes                    |
    | reseller                   |
    | rss_cache_horoscope        |
    | rss_cache_weather          |
    | schedule_events            |
    | screenshots                |
    | service_in_package         |
    | services_package           |
    | settings                   |
    | singer                     |
    | stb_groups                 |
    | stb_in_group               |
    | storage_cache              |
    | storage_deny               |
    | storages                   |
    | storages_failure           |
    | stream_error               |
    | stream_zones               |
    | streaming_servers          |
    | support_info               |
    | tariff_plan                |
    | tasks_archive              |
    | testers                    |
    | tv_archive                 |
    | tv_aspect                  |
    | tv_genre                   |
    | tv_reminder                |
    | updated_places             |
    | updates                    |
    | user_downloads             |
    | user_log                   |
    | user_modules               |
    | user_package_subscription  |
    | user_played_movies         |
    | users                      |
    | users_activity             |
    | users_rec                  |
    | vclub_ad                   |
    | vclub_ad_deny_category     |
    | vclub_ads_log              |
    | vclub_not_ended            |
    | vclub_paused               |
    | video                      |
    | video_clip_genres          |
    | video_clips                |
    | video_log                  |
    | video_on_tasks             |
    | video_records              |
    | video_rent                 |
    | video_rent_history         |
    | video_season               |
    | video_season_series        |
    | video_series_files         |
    | watched_settings           |
    | weatherco_cache            |
    +----------------------------+
    158 rows in set (0.00 sec)


4)更改指定数据库的密码

    mysql> update administrators set pass=MD5('new password') where login='admin';
    Query OK, 1 row affected (0.00 sec)
    Rows matched: 1  Changed: 1  Warnings: 0
    mysql> quit
    Bye


原文链接:https://blog.csdn.net/u014558668/article/details/79269605

【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。