正在加载图片...
and change the line bind-address -localhost to your own internal ip addresse.g19.168.120 bind-address =192.168.1.20 Ifyour ip address is dynamic you the bind-address line andt will default to your current ip. If you try to connect without changing the bind-address you will recieve a"Can not connect to mysql eTor10061" Set mysql root password Before accessing the database by console you need to type: mysql -u roo At the mysql console type: mysql>SET PASSWORD FOR 'root'@'localhost'-PASSWORD('yourpassword'); A successful mysql command will show Mysql commands can span several lines.Do not forget to end your mysql command with a semicolon. Note:Ifyou have already set a password for the mysql root,you will need to use: s mysql -u root -p (Did you forget the mysql-root password?) Create a mysql database mysql>CREATE DATABASE databasel; Create a mysql user For ereating a new user with all privileges(use only for troubleshooting),at mysql prompt type: mysql>GRANT ALL PRIVILEGES ON.TO 'yourusername'e'localhost' For creatinganewuser with fewer privileges(should work for most web applications)which can ony use the database named"databasel"at mysql prompt type: S mysq1>GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,ALTER CREATE TEMPORARY TABLES,LOCK TABLES ON databasel.*TO 'yourusername'e'localhost'IDENTIFIED BY 'yourpassword'i yourusername and yourpassword can be anything you like.databasel is the name of the database the user gets access to.locahs is the location which gets access to your database.You can change it to %(or to hostnames or ip addresses)to allow connections from every location (or only from specific locations)to the database.Note,that this can beaseurity problemand should ony be used for testing purposes! To exit the mysgl prompt type: and change the line: bind-address = localhost to your own internal ip address e.g. 192.168.1.20 bind-address = 192.168.1.20 If your ip address is dynamic you can also comment out the bind-address line and it will default to your current ip. If you try to connect without changing the bind-address you will recieve a "Can not connect to mysql error 10061". Set mysql root password Before accessing the database by console you need to type: $ mysql -u root At the mysql console type: $ mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('yourpassword'); A successful mysql command will show: Query OK, 0 rows affected (0.00 sec) Mysql commands can span several lines. Do not forget to end your mysql command with a semicolon. Note: If you have already set a password for the mysql root, you will need to use: $ mysql -u root -p (Did you forget the mysql-root password? See MysqlPasswordReset.) Create a mysql database $ mysql> CREATE DATABASE database1; Create a mysql user For creating a new user with all privileges (use only for troubleshooting), at mysql prompt type: $ mysql> GRANT ALL PRIVILEGES ON *.* TO 'yourusername'@'localhost' IDENTIFIED BY 'yourpassword' WITH GRANT OPTION; For creating a new user with fewer privileges (should work for most web applications) which can only use the database named "database1", at mysql prompt type: $ mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES ON database1.* TO 'yourusername'@'localhost' IDENTIFIED BY 'yourpassword'; yourusername and yourpassword can be anything you like. database1 is the name of the database the user gets access to. localhost is the location which gets access to your database. You can change it to '%' (or to hostnames or ip addresses) to allow connections from every location (or only from specific locations) to the database. Note, that this can be a security problem and should only be used for testing purposes! To exit the mysql prompt type:
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有