mysql> use mysql;
mysql> select User,Host,Password from user;
+----------+-----------------------+-------------------------------------------+
| User | Host | Password |
+----------+-----------------------+-------------------------------------------+
| root | localhost | |
| root | localhost.localdomain | |
| root | 127.0.0.1 | |
| | localhost | |
| | localhost.localdomain | |
| admin | % | *4ACFE3202A5FF5CF467898FC58AAB1D615029441 |
| admin1 | % | *6D45FD76D5E9C6A404E39C25106A7F032659ACB8 |
| chen | % | *A174C9E936AC7A4D7B5879283828BC1949D9E699 |
| wang | % | *4DB9D7B9A1EE2F9646C3A6A1CC9A37942588BFBF |
| testuser | % | *3A2EB9C80F7239A4DE3933AE266DB76A7846BCB8 |
+----------+-----------------------+-------------------------------------------+
10 rows in set (0.00 sec)
数据库中的所有用户都只能本地登录,
为用户设定密码的方式:
1.set password for ‘USERNAME‘@‘HOST‘=PASSWORD (‘password‘);
mysql> set password for ‘root‘@‘localhost‘=password ( ‘root‘ );
mysql> flush privileges; 让系统重读授权表
2.#mysqladmin -uroot -proot -hHOST password ‘password‘
3.mysql> update user set Password=password(‘root‘) where User=‘root‘ and Host=‘127.0.0.1‘; 直接丢该表里的数据
and
or
not
建立一个远程连接并且具有所有权限;
mysql> grant all privileges on *.* to ‘root‘@‘%‘; identified by ‘root‘;
图形客户端工具:
phpmyadmin
workbench
mysql front
navicat for mysql
toad
###########
解决navicat for mysql 报错的问题:Lost connection to MySQL server at ‘reading initial communication packet‘, system error: 0
首先用vim打开my.cnf:
复制代码 代码如下:
vim /etc/mysql/my.cnf
看看是否有绑定本地回环地址的配置,如果有,注释掉下面这段文字:(在文字之前加上#号即可)
复制代码 代码如下:
bind-address = 127.0.0.1
然后找到[mysqld]部分的参数,在配置后面建立一个新行,添加下面这个参数:
skip-name-resolve
保存文件并重启MySQL:
复制代码 代码如下:/etc/init.d/mysql restart
[[email protected] ~]# yum install -y php-mysql 安装驱动
cd /www/a.com
vi index.php
此字段将mysql和php连接到一起
<title>A</title>
<h1>a.com</h1>
<?php
$conn=mysql_connect(‘localhost‘,‘root‘,‘root‘);
if (!$conn)
echo "Success...";
else
echo "Failur...";
?>
修改配置文件后 都需要重启服务才能生效
------------------------------------------------
<?php-mysql
$conn=mysql_connect(‘localhost‘,‘root1‘,‘root1‘);
if (!$conn)
{
die(‘Could not connect:‘ . mysql_error());
}
mysql_select_db("mydb",$conn);
$result = mysql_query("select * from tb1");
while($row = mysql_fetch_array($result))
{
echo $row[‘Name‘] . " " . $row[‘Age‘];
echo "<br />";
}
mysql_close();
?>
-----------------------------------------------
LAMP:
phpMyAdmin 通过php页面管理数据库的
https://www.phpmyadmin.net/downloads/ 下载地址
只需要放到/www/a.com解压即可通过浏览器访问
论坛程序:
discuz www.discuz.net
phpwind
phpbb
下载程序以后依附LAMP平台进行部署即可,下载GBK。 #Discuz_X3.2_SC_GBK
[[email protected] a.com]# mv ../upload/* ./
把upload里的数据放到a.com里
#AddDefaultCharset UTF-8 注释掉UTF-8
[[email protected] a.com]# service httpd restart
CMS:
drupal
joomla
LAMP
wordpress 个人博客系统