日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

mysql安装后配置

發布時間:2024/9/30 数据库 25 豆豆
生活随笔 收集整理的這篇文章主要介紹了 mysql安装后配置 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

1:配置my.cnf

原來的配置

[root@feng02 ~]# cat /etc/my.cnf [mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock user=mysql # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0[mysqld_safe] log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid

修改后

[root@feng02 ~]# cat /etc/my.cnf [client] password = 123456 port = 3306 default-character-set=utf8 [mysql] default-character-set = utf8 [mysqld] port = 3306 character_set_server=utf8 character_set_client=utf8 collation-server=utf8_general_ci lower_case_table_names=1 max_connections=1000 datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock user=mysql # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0[mysqld_safe] log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid
2:初始化MySQL

輸入:/usr/bin/mysql_install_db

[root@feng02 ~]# /usr/bin/mysql_install_db Installing MySQL system tables... 150905 13:51:04 [Warning] /usr/libexec/mysqld: ignoring option '--character-set-client-handshake' due to invalid value 'utf8' OK Filling help tables... 150905 13:51:04 [Warning] /usr/libexec/mysqld: ignoring option '--character-set-client-handshake' due to invalid value 'utf8' OKTo start mysqld at boot time you have to copy support-files/mysql.server to the right place for your systemPLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER ! To do so, start the server, then issue the following commands:/usr/bin/mysqladmin -u root password 'new-password' /usr/bin/mysqladmin -u root -h feng02 password 'new-password'Alternatively you can run: /usr/bin/mysql_secure_installationwhich will also give you the option of removing the test databases and anonymous user created by default. This is strongly recommended for production servers.See the manual for more instructions.You can start the MySQL daemon with: cd /usr ; /usr/bin/mysqld_safe &You can test the MySQL daemon with mysql-test-run.pl cd /usr/mysql-test ; perl mysql-test-run.plPlease report any problems with the /usr/bin/mysqlbug script!
3:啟動Mysql

[root@feng02 ~]# service mysqld start Starting mysqld: [ OK ]
4:連接Mysql

輸入:mysql -uroot -p

直接回車,不用輸入密碼

[root@feng02 ~]# mysql -uroot -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.1.73 Source distributionCopyright (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> update user set password=password('123456') where user='root'; ERROR 1046 (3D000): No database selected mysql> show database; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'database' at line 1 mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | test | +--------------------+ 3 rows in set (0.00 sec)
設置root的密碼:

輸入:use mysql;

輸入:update user set password=password('123456') where user='root';

mysql> use mysql; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -ADatabase changed mysql> update user set password=password('123456') where user='root'; Query OK, 3 rows affected (0.01 sec) Rows matched: 3 Changed: 3 Warnings: 0mysql> exit Bye
5:重啟mysql

輸入:service mysqld restart

[root@feng02 ~]# service mysqld restart

Stopping mysqld: [ OK ] Starting mysqld: [ OK ]
6:使用密碼登陸:

[root@feng02 ~]# mysql -uroot -p123456 Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 4 Server version: 5.1.73 Source distributionCopyright (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>
7:設置允許遠程登錄

輸入:use mysql;
輸入:select host,user,password from user;
輸入:update user set host='%' where user='root' and host='localhost';
輸入:flush privileges;
輸入: exit;

mysql> use mysql; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -ADatabase changed mysql> select host,user,password from user; +-----------+------+-------------------------------------------+ | host | user | password | +-----------+------+-------------------------------------------+ | localhost | root | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 | | feng02 | root | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 | | 127.0.0.1 | root | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 | | localhost | | | | feng02 | | | +-----------+------+-------------------------------------------+ 5 rows in set (0.00 sec)mysql> update user set host='%' where user='root' and host='localhost'; Query OK, 1 row affected (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 0mysql> flush privileges; Query OK, 0 rows affected (0.02 sec)mysql> exit; Bye


8:連接需要輸入IP或主機名了
[root@feng02 ~]# mysql -uroot -p123456 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) [root@feng02 ~]# mysql -hfeng02 -uroot -p123456 Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 9 Server version: 5.1.73 Source distribution


總結

以上是生活随笔為你收集整理的mysql安装后配置的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。

主站蜘蛛池模板: 黄网站色视频免费观看 | 精品女同一区二区三区 | 中文字幕av不卡 | 美女张开腿流出白浆 | 四虎在线免费视频 | 久久久久久久久久久久久久免费看 | 久久一区二 | 视频在线观看网站免费 | 午夜国产免费 | 一级做a爰片 | 神马午夜视频 | 黄色av国产 | 超碰天天操 | 国产做受91 | 亚洲欧洲一区二区 | 国产中文字幕在线免费观看 | 国产欧美日韩一区 | 欧美黑人三级 | 亚洲天天看| 亚洲最大av | 亚洲精品色午夜无码专区日韩 | 特黄视频 | 涩涩视频免费观看 | 亚洲伊人精品 | 欧美一区国产一区 | 日韩少妇内射免费播放18禁裸乳 | 美女超碰在线 | 亚洲精品欧美日韩 | 日本一本高清 | 色女人网 | 亚洲视频在线免费观看 | 熟睡人妻被讨厌的公侵犯 | 91av俱乐部 | 2019国产在线 | 亚洲一区国产精品 | 视频一区 中文字幕 | 色久影院| 欧美精品四区 | 97人人艹 | 影音先锋波多野结衣 | 在线一区av| 免费看黄网址 | 免费高清欧美大片在线观看 | 国产精品激情 | 亚洲视频一区二区在线观看 | 米奇7777狠狠狠狠视频 | 在线观看av的网站 | 国产伦精品一区二区三区在线 | 欧美视频精品 | 色女生影院 | 胖女人做爰全过程 | 亚洲一区二区国产精品 | 亚洲自拍第三页 | 精品人妻少妇AV无码专区 | 日本黄页视频 | 99精品区 | 国产精品 日韩 | 奴性女会所调教 | 中文字幕十一区 | 99这里 | 超碰人人人人 | 国产又猛又粗 | 理想之城连续剧40集免费播放 | 熟女肥臀白浆大屁股一区二区 | 奇米99 | 99久久精品一区二区 | 最新中文字幕一区 | 日韩黄色网页 | 久草这里只有精品 | 成人精品久久久午夜福利 | 久草视频播放 | 中文字幕日韩一级 | 一级片视频网站 | 好吊妞精品 | 性感美女在线观看 | 欧美日批| 亚洲精品国产欧美在线观看 | 国产精品宾馆在线精品酒店 | 手机在线小视频 | 竹菊影视一区二区三区 | 伊人久久中文字幕 | 精品国产乱码久久久久久牛牛 | 久久久在线观看 | 成人免费毛片aaaaaa片 | 综合天天 | 亚洲黄色片在线观看 | 亚洲国产精品女人久久久 | 性欧美成人播放77777 | 久久综合九色综合欧美狠狠 | 波多野结衣亚洲视频 | av网址在线免费观看 | 久久久片 | 第一福利视频 | 亚洲精品av在线 | 无人在线观看高清视频 | 超级变态重口av番号 | 男人和女人做爽爽视频 | 国产原创在线播放 | 精品无码久久久久久国产 |