This article describes in detail the initial settings after installing the MySQL database in Ubuntu. 1. it should be easy to install MySQL, and I don't think there is much problem in the installation, so I will not talk about it much. Next let's talk about the configuration. 2. configure MySQL. Note that MySQL in Ubuntu only allows local access by default. if you want access from other machines, install Ubuntumysql.
This article describes in detail the initial settings after installing the MySQL database in Ubuntu.
1. it should be easy to install MySQL, and I don't think there is much problem in the installation, so I will not talk about it much. Next let's talk about the configuration.
2. configure MySQL. Note that MySQL in Ubuntu only allows local access by default. if you want access from other machines, change/etc/mysql/my. cnf configuration file!
After the default MySQL installation, the root user does not have a password. Therefore, use the root user to enter: $ mysql-u root here uses-u root because I am a general user (firehare). if-u root is not added, mysql will assume that it is a firehare login.
Note: I have not entered the root user mode here because it is unnecessary. In general, it is not necessary to enter the root user mode to operate the database in mysql. this is only possible when the database is set. After entering mysql, the most important thing is to set the root user password in Mysql. Otherwise, the Mysql service is no longer secure.
Mysql> grant all privileges on *. * TO root @ localhost identified by "123456 ";
Note: I use 123456 as the root user password, but this password is not safe. please use a password with a mix of uppercase and lowercase letters and numbers, and at least 8 characters. In this case, the root user password in MySQL is set up, and then the database you need is created with the root user.
Here we take xoops as an example:
mysql>CREATE DATABASE xoops; mysql>GRANT ALL PRIVILEGES ON xoops.* TO xoops_root@localhost IDENTIFIED BY "654321"; |
In this way, a xoops_roots user is created, which has all permissions on the database xoops. In the future, we will use xoops_root to manage the xoops database, instead of using the root user. this user's permissions will only be limited to the xoops database.
If you want to implement remote access or control, you have to do two things:
1:
Mysql> grant all privileges on xoops. * TO xoops_root @ "%" identified by "654321 ";
Allows the xoops_root user to log on to MySQL from any machine.
Second:
$ Sudo gedit/etc/mysql/my. cnf> skip-networking => # skip-networking
This allows other machines to access MySQL.
GUI software for connecting to the database in Ubuntu: mysql-admin mysql-query-browser.
How to handle garbled data when dapper is upgraded to MySQL5 + PHP5 occurs when gbk is used as the website internal code.
I. export data:
mysqldump -uroot -p --default-character-set=latin1 --set-charset=gbk --skip-opt mydatabse > d.sql |
2. create a new database:
CREATE DATABASE `newmydatabase` DEFAULT CHARACTER SET gbk COLLATE gbk_chinese_ci; |
III. re-import data:
mysql -uroot -p --default-character-set=gbk -f newmydatabase >source d.sql ..... >exit |
Modify the data of your forum or website to newmydatabase.