MySQL 更改数据库密码

环境: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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值